Marking a set time each day - Tracking Swings

Feb 2 , 2005

16:33 @Ens_HA: Welcome to today's training class with the program developers.

16:33 @Ens_HA: We have more cool things to share and show dealing with features found in the 02-02 Beta version of Ensign.

16:33 @Ens_HA: You may want to upgrade either now or after the class so you can do the same things that I demonstrate in the class.

16:33 @Ens_HA: Material for today's class is prompted by recent requests via chat room or e-mail about what some users are attempting to do with the

16:33 @Ens_HA: Design Your Own study form (DYO).

16:34 @Ens_HA: So the examples may be really helpful to the one asking for them particular feature, and informative in general ways to everyone else. The examples show the process I may have used to accomplish the requested task and in so doing, it teaches how some things might be done that would be used by others with similar tasks

 

16:35 @Ens_HA: so lets get going with our first example. After the training we will have a general Q&A period. So please hold other questions until then but ask question related to the topic I am covering if you do not understand what I am covering.

16:37 @Ens_HA: In this first example, the yellow band range is obtained from the Highest High and Lowest Low between 12:00 and 13:00

16:38 @Ens_HA: This would be similar to some ranges others are obtaining from the first 60-minutes of the day. I thought it would be useful to show how other time periods of the day could be the source for the range.

16:39 @Ens_HA: the band on the left of the chart is the H/L range from the 12-13 time period of the prior day.

16:40 @Ens_HA: Then when we hit 12:00 today, the band range starts over and you can see it widening though the 12-13 time period as new highs and new lows occur during that period of time. Then the band range become set for the next 23 hours....

16:40 @Ens_HA: So, how did I do that?

16:41 @Ens_HA: Let me show you the DYO form that watches the bar times, and determines a range from only the bars in the target time period.

16:41 @Ens_HA: Let me describe the actions performed by each of the 10 lines on this DYO form.

16:42 @Ens_HA: Line A returns the bar index for the bar following the 12:00 time stamp and stores this index in GV [1]

16:44 @Buffy2: Howard, would you please explain what you mean by bar index thanks

16:44 @Ens_HA: a bar's index is its position is an array or set of bars. Left most bar is number 1, and last bar on the chart is in last position.

16:42 @Ens_HA: Line B returns the bar index for the 13:00 bar and stores the index in [2]

16:43 @Ens_HA: now, think about what is happening as the bars are building from left to right across the screen.

16:44 @Ens_HA: Lets assume there are 100 bars per day on the chart and the first 12:00 bar is at index 50 and the first 13:00 bar is at index 60.

16:44 pappy: 10 bars per hour?

16:45 @Ens_HA: no pappy, it could be any number of bars per hour, but I am trying to make the teaching example simple to follow.

16:46 @Ens_HA: So on the first day, assume 12:00 bar is the 50th bar in the set and the 13:00 bar is the 60th bar in the set and we add 100 bars per day.

16:46 @Ens_HA: That means on the 2nd day the 12:00 bar would be the 150th and the 13:00 would be the 160th, etc., OK?

16:47 @Ens_HA: So for awhile [1] will have a value of 50...... and then the next day at noon it will be updated to hold 150.....

16:47 @Ens_HA: and then the next day it would change to hold index 250 etc.

16:47 tradinoncoffee: so the alert is constantly rewriting the relative value of the bars index assignment

16:47 @Ens_HA: yes, toc, that is what I am teaching....

6:48 @Ens_HA: Line A will evaluate for each bar position as the chart progresses from very first bar to very last bar, and the contents of [1] is going to change once per day.

16:48 @Ens_HA: it was 50 then 150 then 250 then 350 etc and the [2] for the 13:00 bar was 60 and then 160 and then 260 and then 360.

16:49 @Ens_HA: now, realize that [1] will go from 50 to 150 at noon the 2nd day, but until 13;00 [2] will still hold a 60 - [2] will not go from 60 to 160 until 13:00

16:50 @Ens_HA: so this stagger of time of one hour between when [1] goes to new value and when [2] goes to new value is the principle behind the test on Line C

16:51 @Ens_HA: When Value [1] is greater than the Value [2] we then know that we must be between 12:00 and 13:00

16:51 @Ens_HA: Only when we are between 12:00 and 13:00 will the [1] content have jumped to a higher index value than the [2] index.

16:51 @Ens_HA: once we are past 13:00, then [2] will hold a value higher than [1]

16:52 @Ens_HA: So, Line C will be TRUE between 12:00 and 13:00 and False between 13:00 and the next day's 12:00

6:53 @Ens_HA: I am taking so long to explain this principle, because it is key to the detection of being in the time period between 12:00 and 13:00

16:53 @Ens_HA: I do have other tools we could have used for a fixed hour period, but this illustration using two unrelated times is showing the greatest flexibility.

16:54 @Ens_HA: So lines A, B and C are accomplishing a boolean flag that is True when the bar time is in the time period from 12:00 to 13:00

16:54 @Ens_HA: any questions on this part of the example?

16:55 @Buffy2: neat trick

16:55 tradinoncoffee: so we can use this for any study requiring a time range, ie 60M OR, Pivots for Day Session etc???

16:55 @Ens_HA: yes, it can be considered a trick,. and that is why I am showing you

16:56 @Ens_HA: yes, toc, it is a general principle I am showing you about time, and how to think about it as the chart evaluates from first bar through last bar.

16:56 tradinoncoffee: and it will work equally well on Time/Tick/Volume/ or Range?

16:56 @Ens_HA: yes TOC, works equally well on time, tick, volume and range charts.

16:57 tradinoncoffee: ty

16:56 @Ens_HA: ok, lets move on.... the time period flag of line C is stored in [3] for use later on in this DYO form

16:57 @Ens_HA: Line D is another trick..... which I will explain.

16:57 @Ens_HA: I want to use the Max[#] functions later on to find the highest High and the Min[#] function to find the lowest Low. However, the size of the search is variable.

16:58 @Ens_HA: when on a 5 min chart and we are at 12:15 the search size is 3 bars, and then at 12:20 the search size is now 4 bars, and at 12:25 the search size is now 5 bars.

16:59 @Ens_HA: So the trick of Line D is to calculate how many bars exist between the current bar and the bar at the 12:00 time stamp.

17:00 @Ens_HA: The index or bar position is just a sequence on integers counting the bars, which is perfect for knowing how many bars away these 2 bars are from each other.

17:01 @Ens_HA: if the 12:00 bar was index position 350 then the 12:15 bar would be index position 353... and subtracting these 2 numbers gives a value of 3 which is the number of bars between them.

17:01 @Ens_HA: So line D gets current bar Index and subtracts the contents of GV[1], which is the index of the 12:00 bar.

17:02 @Ens_HA: This separation count is saved in [4] for use in the Max function and Min function as the size parameter.

17:03 @Ens_HA: Line E is a conditional test so that Line F is ONLY performed when E is true.... and the Line E test is our Line C flag that is true when the bar index is in the 12-13 time period.

17:03 @Ens_HA: Line F finds the Highest High for the last # of bars and the value for # comes from the contents of gv [4]

17:03 @Ens_HA: That is a slick trick

17:04 @Ens_HA: The Max function parameter for the number of bars to search is dynamic by using the contents of the GV [4]

17:05 @Ens_HA: This resulting range high value is stored in [5] and will only be updated between 12:00 and 13:00

17:06 @Ens_HA: Line G and H do the same condition test to only update the Low range value between 12:00 and 13:00 - the low range value is stored in [6]

17:06 @Ens_HA: Then lines I and J fetch the current high and low range values and plots the spread between them as a yellow band.

17:07 @Ens_HA: That's it.... this example employs a few tricks to detect being in a time period, variable size for Max and Min functions, and conditional calculations.

17:07 @Ens_HA: I hope you enjoy learning from it.....it is primarily a teaching example.

17:08 @Ens_HA: I do not propose that there is anything magical about the range of the 12-13 time period.

17:08 @Ens_HA: Any questions?

 

17:08 amg: the Condition operates on the prior box and is a gate for the next box?

17:10 @Ens_HA: Line E and G are conditions.... the logic is found in the Field and for these the logic was to load the GV flag from [3] - this flag was stored by line C

17:11 @Ens_HA: so if Line E test is True ie [3]=True then Line F will execute.....if [3]=False then Line F and only F is skipped.

17:12 @Ens_HA: for a Conditions category, only the following line is either executed or skipped.

17:11 amg: yes, thank you - that's it exactly, thx

 

17:10 Shar: When you were giving the example for the 5M and explaining how many bars it would look at, is that in the Read GV column?

17:13 @Ens_HA: Shar, the Line A finds the index for 12:00 and stores this in [1], and then that value is used for the bar count discovery on line D.

7:13 @Ens_HA: the 1 for GV[1] comes from the Read GV spinner box.

17:13 @Ens_HA: The size of the Next[#] comparison uses a 1 also from the Value or # field.

17:13 Shar: Ok, thank you.

 

17:14 tradinoncoffee: if we use this same DYOS on different instruments using the SAME GV's, there is no conflict correct?

17:15 @Ens_HA: almost TOC....... the values in [5] and [6] are only updated during one hour of the day, so there is the expectation that these 2 GVs remain untouched for the remaining 23 hours of the day.....

17:15 @Ens_HA: So their could be a conflict if another chart used the same example or used [5] and [6] in some other way.

17:16 @Ens_HA: The other GVs on this form [1]..[5] are reestablished with each bar evaluation and could be overwritten or reused.

17:16 tradinoncoffee: so in designing a workspace, 5 and 6 are now spoken for

17:16 @Ens_HA: correct, [5] and [6] are spoken for and need to be left alone and not reused somewhere else.

17:17 tradinoncoffee: ty

17:17 @Ens_HA: I guess a standard might be established that implies this....possibly using very high GV numbers for those that need to be left alone.

 

17:18 phi: is there a way to get a list of the global vars used, like a "quote page"

17:19 @Ens_HA: yes phi, what you do is open a custom quote page for 'Variables' and it will show a matrix of all 100 GVs

17:19 @Ens_HA: an example looks like the following.

17:20 phi: Thanks.

17:20 @Buffy2: the chart objects report says what that chart is using for gv's also

17:20 @Ens_HA: I use this often to see what the steps in my DYO are doing to be sure my logic is correct.

17:20 dblue2: But if a true false global variable is not "true" can you tell it is being used?

17:20 @Ens_HA: True boolean will show the word True and False will show a blank on the quote page

17:21 amg: that's also a good reason to make a DYO in a clean w/s

17:21 dblue2: so 51 could have a global assigned if it is false

7:21 @Ens_HA: correct dblue2

7:22 @Ens_HA: in my example [3] is being used and happens to hold a False now as the time is outside of the 12-13 time period.

17:21 dblue2: thx

 

Example 2

17:23 @Ens_HA: ok now for 2nd example.

7:24 @Ens_HA: here is the image for the 2nd example, and it does not mean much until I show the DYO for it.

17:25 @Ens_HA: Tricky, this is your example with some more added that you wanted.

7:25 @Ens_HA: it is also a good training example so will discuss it for the education of how to do stuff.

17:26 Tricky: Thank you very much Howard

17:26 @Ens_HA: there is a Pesavento patterns tool on the chart and everything about this DYO is related to what the PP is doing

17:26 @Ens_HA: let me show the PP form and then return to the DYO form

17:27 @Ens_HA: On this PP form, there are 4 GVs, and what they hold is the swing prices for the last 4 swing points.

17:27 @Ens_HA: The GVs do not have anything to do with the 4 lines on the form they happen to show on.

7:27 @Ens_HA: So, in [1] we store the current swing price.

17:28 @Ens_HA: the 2nd GV is the prior swing price and this price I want to store in [3] for a reason.

17:28 @Ens_HA: The 3rd GV is the 3rd swing price going back in time and I want to store it in [2] for a reason.

17:29 @Ens_HA: the 4th GV has the 4th swing price going back in time and store it in [4].

17:29 @Ens_HA: now back to the chart.

17:30 @Ens_HA: so the 4 swing prices being harvested from the PP study are marked by numbers 1,2,3 and 4 in the example.

7:31 @Ens_HA: what Tricky wanted to know was when a uptrend existed by having the relationship that point 1 was higher than point 3 and point 2 was higher than point 4.

17:32 @Ens_HA: let me reposition chart to show an example of this formation.

17:33 @Ens_HA: here is such a formation he wants to be alerted regarding.

17:34 @Ens_HA: you can see 1 is higher than 3 and 2 is higher than 4

7:34 @Ens_HA: when this formation relationship occurs, the DYO shows the section message in green and the text 'Up Trend'

17:34 @Ens_HA: Ok, that is the objective for the example. Lets return to the DYO and see how we do that.

17:36 @Ens_HA: Line A does the relationship test for points 1 and 3, whose values are in [1] and [2]

7:36 @Ens_HA: now you see why on the PP form I put the 3rd swing point in [2], so it would be Next to [1] for this test.

17:37 @Ens_HA: When point 1 is above point 3 ([1]>[2]) we store a True in [5] and throw a circle marker on the chart as a visual aid.

17:38 @Ens_HA: Line B does the test for point 2 being above point 4 ([3]>[4]) and stores a True in [6] and does a little red marker on the chart

17:38 @Ens_HA: Line C does the test for BOTH Line A and Line B being simultaneously true.... by ANDing two flags starting with [5]

17:39 @Ens_HA: so LIne does tests [5] AND [6] but does not store the result.

17:40 @Ens_HA: Note that the Message location is Section 1 and that the section will show either a green background or a red background based on the logic from Line C. That is the purpose of the Line Logic drop down box. Use it to tell the Section panel which line of the DYO has the logic or answer.... in this case a boolean True or False from our 2 condition tests.

17:42 @Ens_HA: When the formation pattern is not seen, the message after the vertical line ie 'false' is shown as the text and the panel color will be Red.

17:42 @Ens_HA: Any questions about Lines A,B, and C and how they control the Section color and text??

 

17:43 zol2: didn't catch how they color the section text .. sorry

17:43 @Ens_HA: zol, Line C is boolean True or False, and the Line Logic drop down is selecting Line C as the line to use to control the panel

17:44 @Ens_HA: If the Line C result is True, the message text to the left of the vertical line is shown and the panel colored the True color.

17:44 @Ens_HA: If the line C result is False, then the message text to the right of the vertical line is shown and the panel colored the False color in. The True color box below the Section box is Green, and the False color box is showing Red.

17:45 amg: so Line Logic is new on this form - does Line Logic show up only if a line does a logical test? (ie, not on the basic DYO form)

17:48 @Ens_HA: amg, Line Logic drop down will show when Section selection is not on None.

17:48 amg: ty

17:45 zol2: thanks, I see that now.

 

17:43 @Ens_HA: Ok, tricky, now for the other part of your request, which was implemented today.

17:45 @Ens_HA: now tricky, the new stuff added was to expose the bar Indexes for the last 4 Pesavento swing points.

17:46 @Ens_HA: for the sake of a visual on the Quote | Variables page I used Lines D through G to get the 4 swing indexes and dump them into [7] [8]

17:47 @Ens_HA: [9] and [10] and as expected, [7] had an index higher than [8] etc.

17:48 @Ens_HA: tricky, now that you have the bar positions for the last 4 swing points in [7] through [10] you should be able to do your Fib ruler thing and a simple example of that is illustrated for you in lines H through J

17:49 @Ens_HA: Line H will get the spread (bar count) between the 2nd and 3rd swing points going back in time.

17:50 @Ens_HA: Say the 3rd point is at index 110 and the 2nd point is at index 115... Line H would compute that they are 5 bars apart.

17:51 @Ens_HA: This bar count is stored in [7] so it can be used in Line I to compute a future bar index.

17:51 @Ens_HA: Line I multiplies the bar count by a Fib factor, in this case 2, and adds this offset to the 2nd swing index position.

17:52 @Ens_HA: so we compute a future index of 2* 5 + 115 = 125

17:52 @Ens_HA: and we use Line J to mark bar at index position 125 with a Zone red color.

17:52 @Ens_HA: that is the source of the red stripes on the first chart example.

17:53 @Ens_HA: does that help you with the method Tricky???

17:53 Tricky: Great Howard thanks and yes, I would think so

17:54 @Ens_HA: Now, let me offer a word of caution about a little gottcha here.

17:54 @Ens_HA: You really need to add another function between lines I and J to get it to work with a general Fib multiplier like 1.618

17:54 @Ens_HA: Bar Index is going to be an Integer and it is being compared to a value in [7]

17:55 @Ens_HA: when you multiply the spread distance by 1.618 on Line I you end up with a decimal number that contains a fraction. That would cause the test for Bar Index = # to fail. Hence, the need to also do a Global Value | Round(Value+#) type of statement between line I and J

17:56 @Ens_HA: That way the value you store in [7] is an integer and not a number with a fraction.

17:56 amg: that's for the fib ruler part, right?

17:56 @Ens_HA: yes amg, for the fib ruler he wanted automated.

7:57 amg: this looks really potent

17:57 @Ens_HA: Tricky wanted to detect a couple of swing points, possibly points 2 and 4 and use the horizontal bar count as a offset from say point 3 or point 2 to forecast the TIME of a future swing turn.

17:57 @Ens_HA: Good ideas here, and I am showing the basics of how you would do that. This is not a complete example, but a teaching example and you can take the ideas and run with it.

17:58 @Ens_HA: Right now, Tricky manually puts on a Fib Ruler with construction points on PP swings 2 and 4 or 3 and 1 or 2 and 1 and lets the ruler mark a future point.

17:59 @Ens_HA: The idea was to automate the Fib forecast using DYO to automatically get those swing points (time wise) and forecast a measured distance into the future.

18:00 @Ens_HA: So, take it and run with it..... you all will come up with some clever stuff....

8:00 @Ens_HA: That is it for the 2nd example,

 

8:08 @Ens_HA: Ok, I will take a few questions now, one at a time, and then call it a wrap for today.

18:08 phi: question when ready

18:08 @Ens_HA: ok phi you are first

18:09 phi: so I take it that the container to store a DYO is a template or a workspace?

18:10 @Ens_HA: no... a DYO is just another study like any other study. The chart can load these studies when it reopens. Or, if you have a collection of studies, you can save the collection as a Template, and the DYO is just one of several that can be in the template collection.

18:11 @Ens_HA: A workspace is a collection of charts, including all of their lines and studies.

18:11 phi: so if named it will show up in the studies list?

18:12 @Ens_HA: yes, phi, what you have on the chart you can save to a template using the name of your choice.

8:13 @Ens_HA: You get the chart the way you want it, then click on the Template button to show the template panel, and click the Save As button and enter the name of your choice. The newly created template will then show on your templates list.

18:13 phi: right, I see how to save as a template. I just wanted to know if there was something else.

18:13 @Ens_HA: nope, nothing else, it is that simple.

18:13 phi: ok, thanks.

 

18:14 @Ens_HA: ok, stelios, welcome to all of England and your turn.

18:15 Stelios: re the example with Tricky and the 1 2 3 4 trend change - can I do the same using the minor trends instead of the Pesavento tool

18:16 @Ens_HA: 1 moment as I ponder

18:25 @Ens_HA: Stelios, I think so doing something like this to get you started.

18:26 @Ens_HA: The chart has the Minor Trends color bar study applied, and then the DYO is getting the bar color on Line A

18:27 @Ens_HA: Line B tests the color as you see and when the color is the Bullish Color (ie=1) a marker is plotted on the top row 2 of the chart.

18:27 @Ens_HA: This is the starting point.... now that you know you are in the Up trend or the down trend you can other lines of logic to possibly do any of the following.

8:28 @Ens_HA: 1) In an uptrend keep track of the highest high

18:28 @Ens_HA: and 2) keep track of lowest low in a down trend.

8:29 @Ens_HA: or 3) get the bar index of the first or last bar in your trend before you do a trend color change, etc.

18:29 @Ens_HA: the color bar will not return four swing prices or four swing indexes like the PP study did in the class today.

18:30 @Ens_HA: but you do have the key here of knowing which trend you are in and you can then discover your own bar prices or bar indexes with selection features on the DYO.

18:30 Stelios: thank you, Howard, goodnight

 

18:30 @Ens_HA: ok, next question. which I think is buffy's turn.

18:30 @Buffy2: when you are using the same GVs on different charts is there any order in how they are printed to the variables quote sheet

18:31 @Ens_HA: the order is purely random of who last executed.....

18:31 @Ens_HA: the quote sheet will show current values, and you do not know if a shared GV was last updated by your ES chart or your NQ chart.

18:31 @Buffy2: tks

 

18:35 @Ens_HA: ok, thx for coming to class today and you all continue to enjoy the program and be successful traders.

18:44 dblue: Big thanks Howard - christophe: many thanks Howards! - Wing2: absolutely.. thanks Sir Howard - Shar: Thanks Howard! - @Buffy2: thanks Howard - Tricky: thx