Global Flags and Variables

November 17 , 2004, revised 11/18/04, 11/20/04

16:35 @Ensign_H: Welcome to our class today..... We have some exciting innovations in the works for a future version that has not been released yet.

16:36 @Ensign_H: This has been the subject of some discussion the past couple of days in the B-Line chat room and we appreciate some of the suggestions and feedback from the examples we have posted.

16:37 @Ensign_H: If any of those here are interested, I can continue (or repeat) our discussion of the innovations being worked on.

 

16:37 amg: yes, I am interested (also, are you in Ventrilo?)

16:39 Tricky: I would love to hear more about the new innovations

16:37 @Ensign_H: Or, we can spend our time answering your questions.

16:38 @Ensign_H: I am not using Ventrilo. I am typing so there is a transcript of the material for Buffy to post to her web site if the material ends up being of value and interest.

16:38 dblue2: With today's esignal problems in mind... perhaps a review of ups and downs of switching between esignal and IB?

16:39 @Buffy 2: in case you don't know Howard, esignal was down for well over an hour today so many were switching feeds

16:39 @Ensign_H: Those on eSignal could change to the Ensign Internet vendor selection and still have ability to right mouse click and refresh a chart from our other Internet sources.

16:39 @Ensign_H: that is a work around that is better than nothing. Many would not have IB feed to switch too, but all could switch to Ensign Internet for the temporary use today to get by. It is not a live feed, but it is better than being totally blind to what is happening.

 

16:41 @Ensign_H: OK, the new innovations are our attempt to address some of the requests of the recent past.

16:42 @Ensign_H: Some of the request have been to support more complex trade signals using the Alert Objects either internal to a given chart, or even to include signals from other charts.

16:42 @Ensign_H: What we have done is to create a set of 100 global variables that always exist when the program is running. You can think of this as 100 mailboxes or 100 buckets that will hold either a number or a Boolean flag (True or False). Any study line can be instructed to park is study value in one of these buckets.

16:44 @Ensign_H: The way we have this implemented is to add a spinner gadget to the study property forms so you can select which bucket to use, where the reference is the number 0 through 99. Let me post an example.

16:48 @Ensign_H: in this example, for the Bollinger band, look at the right side of the study lines, a new Global column is present. The Upper Band is being told to park its value in global variable 1 each time it is calculated. The Average line is being written to global variable 2 and the Lower Band is being written in global variable 3.

16:49 @Ensign_H: Now that these values are in global variables, they can be used by other studies on this chart or by other studies on other charts.

16:50 @Ensign_H: Other studies could already read study values on this chart using Study on Study feature in the Data Point references, but the new global variable provide even more flexibility, which I will illustrate.

16:52 @Ensign_H: The Bollinger band is shown plotted in the Green and White lines. The Alert Object has been added to do the clever additional line plotted at the mid point between the upper band and the Center line.

 

16:53 @Ensign_H: Lets discuss the property form for the Alert object.

16:54 @Ensign_H: The panel A is set to the new Global Value selection, and the Value retrieved is using the Average function. The number value of 2 means it is going to average 2 global variable which are in sequence starting with Global Variable 1

16:55 @Ensign_H: Remember in the Bollinger property form we assigned Upper Band value to park in variable 1 and the Average value to park itself in variable 2. This Ave(##) function is returning the average of global variables 1 and 2, ie value = (V1 +V2)/2

16:56 @Ensign_H: The Marker is the Red dash, and it is being plotted at the Position of the panel 'A' value. So, this clever alert object is able to plot the midpoint between the upper band and the average band.

16:57 @Ensign_H: Let me add a 2nd alert object to plot the midpoint between the lower band and the average center line.

16:59 @Ensign_H: This alert object does the trick for us, the only difference being I used an Orange color and the Global Variable starting point to do the average function is with variable 2 instead of variable 1. So this A panel is returning the average of 2 numbers which are stored in global variables 2 and 3. You can see the implementation is very flexible by using the Number field to indicate how many values to average, and the Global Variable field indicates the starting point in the set of 100 global variables.

 

17:01 @Ensign_H: Let me show you now some of the other Global Variable fields that can be used to return values.

17:01 @Ensign_H: The first choice is Value which returns just one variable value.

The Sum(##) will sum a sequence of values.

Ave(##) we used in our example to return an average value for a sequence.

Min(##) was suggested by one of you and will return the smallest number from a sequence.

Max (##) will return the maximum number in the sequence.

17:03 @Ensign_H: Buffy, the Max and Min might be very clever ways for your B-Line bands to evolve. The idea there is you might check for the Max of the 4 STO lines and plot the highest. That way the quickest one to cross 80 will be plotted, and then the slowest one to leave the above 80 zone will be plotted. Thus you would get kind of a flat top line with quickest on the left side and slowest STO on the right side of the square top wave which is a composite of the 4 stochastic lines. Anyway, we can discuss that idea or evolution of your B-Line ribbons at a later time. Might be interesting evolution of the signal

17:06 @Buffy 2: just trying to make it more visual for those trying to learn multi time frames

17:06 @Ensign_H: the Value-Next and * and / just do math on two adjacent variable

17:06 @Ensign_H: The Value is the one reference by the Global Variable value and Next is the next variable is numerical sequence. So we can subtract two variables, or multiply them, or divide them.

17:08 @Ensign_H: The next entry will add the Number value to the global variable value.

17:08 @Ensign_H: the last entry will multiply Value and Number to return a result.

17:08 @Ensign_H: Number can be negative to do a subtraction instead of an addition and Number can be a decimal to accomplish a division

17:09 @Ensign_H: Any comments or questions before we leave the Global Value part of the innovation.

17:09 DM: Sounds like an excellent improvement so far !

17:10 @Ensign_H: yes, I think it is a powerful improvement

17:10 @Ensign_H: Now, we have more....

17:10 hobo3: can u sum volumes?

17:12 @Ensign_H: no hobo3, but I can ponder stuff like that and possibly add more to the innovation.

17:12 hobo3: thanks

 

17:10 @Ensign_H: There is also a new data selection for Global Flags, which I will show next.

17:12 @Ensign_H: Here is a list of the global flags, which is also very powerful and flexible.

17:13 @Ensign_H: Alert objects can park their Boolean T or F result in a global variable too.

17:13 @Ensign_H: So the Flag would just return the flag from the Global Variable referenced.

17:13 @Ensign_H: Not Flag would return the opposite flag

17:14 @Ensign_H: Count True(##) is potentially very useful for counting voting elves.

17:14 @Ensign_H: you might have 5 different alerts or flags that are parking their T/F results in sequential global variables, such as 10,11,12,13,14

17:15 @Ensign_H: Count True would return how many of the set of 5 are currently showing True. The answer could be 0 through 5

17:16 @Ensign_H: perhaps your signal is to take action when 4 out of the 5 are true, and it does not matter to you which of the 5 are true, just so long as 4 of them agree.

17:16 @Ensign_H: Count False count the number of False variable values in the set.

17:17 @Ensign_H: Like in our Ave example, the ## part of the expression is obtained from the Number field, and the Global Variable field on the form indicates the starting point.

17:17 @Ensign_H: So if Number = 5 and Global Variable = 10, then it would do the counting on buckets 10,11,12,13, and 14.

17:18 @Ensign_H: The AND(##) will do the Boolean AND operation between a series of variables.

17:18 @Ensign_H: The OR(##) will do the OR operation between a series of variable.

17:19 @Ensign_H: Now, if you wanted all 5 of the buckets to be True, you could get back a True or False result using AND(##) with Number =5 and Global Variable = 10.

17:19 @Ensign_H: If you want to act when ANY of the set are true, then use the OR(##) selection.

17:20 @Ensign_H: The AND(##) OR Next will so the AND operation across the set, and then do the final operation with the Next variable that follows.

17:21 @Ensign_H: For example, lets say variable 1 is True, variable 2 is False and variable 3 holds a True.

17:22 @Ensign_H: the selection AND(##) OR Next with Number = 2 and Start point = 1 would be the expression (T AND F) or T - which would return a True.

17:22 @Ensign_H: You can test a Value >, = or < than the value in the Number field.

17:23 @Ensign_H: The Value >= Next(##) is a Boolean flag equivalent to Value > Max(##)

17:23 @Ensign_H: Next(##) is the set following the Value variable

17:23 @Ensign_H: So that is a way to have variable 10, compared to the next 5 variable and tell me if it exceeds them all.

17:24 @Ensign_H: Global Variable start point would be 10 (ie for Value), and Number would be 5 to do a set of next 5 variables.

17:24 @Ensign_H: You get the idea

 

17:25 @Ensign_H: Now the Value >, =, or < High(##) is doing the same type of testing but, on the most recent number of bar high values.

17:26 @Ensign_H: so High(##) with number = 5 would look at current High, prior High, High(-2), High(-3) and High(-4) type of reference, ie the last 5 bar Highs.

17:26 @Ensign_H: For the = case, we find the highest High and return whether Value = that Highest High of last 5

17:26 @Ensign_H: < would find highest High, and return True if value is below that value.

17:27 @Ensign_H: Same logic for Low(##), we find the lowest low of the most recent number of bars, and then

17:27 @Ensign_H: indicate with Boolean T/F whether the Value is >, =, or < that Lowest Low value.

17:28 @Ensign_H: Value > Close(##) would test for value to be above all the closes in the reference set.

17:28 @Ensign_H: Value = Close test just the last bar's close for matching.

17:29 @Ensign_H: further down the list are tests for Open, Volume, and Midpoint

17:30 @Ensign_H: back to the Alert Object form, note the new Global spinner gadget in the Marker frame. it sits between the Position drop down box and the Show True check box. This is where the result for this object can be parked in a global variable.

17:32 @Ensign_H: The tool shows 0, which I consider a throw away bucket. All studies and alerts that I do not intend to reference I set to a default 0 value for the Global spinner. Technically, 0 is a value global variable address, but I am using 0 as the discard bucket.

17:32 @Buffy 2: can number be typed in also

17:33 @Ensign_H: yes you can type in value in the spinner directly, like enter 79 instead of click up 79 times.

 

17:34 @Ensign_H: Now, studies have a new Data point to be able to get their value to operate on from the Global Variables. This mean you could be doing a moving average of a value of a study on another chart.

17:34 @Ensign_H: We already have Study on Study for studies on the same chart. But this new Global variable way to share data will permit some more complicated way of doing thing.

17:35 @Ensign_H: You might have a study on the 3 min chart, and the 1 min chart is plotting it in some way. via the exchange of values being posted to global variables.

17:36 @Ensign_H: Let me show you the Data point selection for a study, like a moving average.

17:41 @Ensign_H: In this image the Data Point is being changed to Global Variable, and the next drop down box shows you some of the choices, you can read a particular variable, or return the Sum, Ave, Spread, Multiply or Divide from some of the variables as a set. The list has to have the choices supported since there is not a Number or a Starting point available with Data point.

17:42 @Ensign_H: In these example, V1 means global variable 1, and V15..V19 means global variables 15 through 19, which would be the sum of those specific 5 global variables.

17:43 @Ensign_H: This may dictate which global variable you need to use to accomplish one of the retrievals.

17:45 @Ensign_H: Admittedly, this Data Point is not a flexible as the selection capability on the Alert Object form which provided both a Number field and a Global Variable field to set the size of the set and the starting point of the set.

17:46 @Ensign_H: One last innovation is the new Bars Since True and False selections that will be available for the Study Value for Alerts. This can be a powerful way to know which alert event occurred most recently.

17:48 @Ensign_H: This example uses this feature to test whether the Flag that triggered True when RSI >= 70 happened before or after the Flag that triggered True when RSI <= 30. The chart had two flags, one for alerting when RSI was high and one for alerting when RSI was low.

17:49 @Ensign_H: The Bars Since True is used to know which happened last, and it colors the chart bars accordingly. Here is the resulting RSI Trend tool.

17:50 @Ensign_H: At the top of the chart are green bands for when RSI >70 and red bands for when RSI <30 - but we want to color the bars on the chart for every bar, and consider the trend in continuation until the opposite alert is triggered. In other words, once RSI goes below 30, continue coloring bars Red, until RSI goes above 70 and then continue coloring bars green until the Red condition is triggered.

17:52 @Ensign_H: Compare the last trend in Green, it starts with the first green band at the top of the chart, and continues coloring bars green even though the RSI goes above 70 and retreats and return to above 70 and retreats. It will color green as long as RSI stays above 30 once it went above 70 to set the mode. So Bars Since True can be a powerful new tool in the arsenal.

17:54 @Ensign_H: Ok, that is enough for today's discussion.

17:54 @Ensign_H: We know there is alot of interest, but we consider this a major enhancement and may have a short beta test phase. Also, I need to quit having more ideas so it settles into a final design.

17:55 amg: your program inspires us too much!

17:55 @Ensign_H: And we need to test for any possible impact on ESPL scripts. Maybe it will be released in a week for beta testers to give feedback.

 

17:57 @Ensign_H: Replace sets a mode to be used when the template is applied. So if you check Replace and then open a template it will clear the chart and put on just this templates studies. If Replace is uncheck at the time the template is opened, then the template gets added to the studies already on the chart.

 

17:59 amg: OK, :) ...sounds like w/Global variables, I can "transpose" an MA from a 5m or 3m chart onto say, a V1000 chart?

18:00 @Ensign_H: good question amg, and the answer is both yes and no. It illustrates a 'gotcha' about referencing other charts, which I can illustrate this way.

18:00 amg: yes, the problem would be time, right?

18:00 @Ensign_H: when a chart opens it does all of its study calculations. There is no way I can think of to cause the other chart which is going to post global values to do so in sync with the studies that update on this chart when this chart opens. In fact, the chart which writes the global values might not even be open yet. So, I can keep studies in calculation synch with each other internal to a chart, like in my example of plotting the mid lines on the bollinger band.

18:03 @Ensign_H: The study which provided the global values was Bollinger, and the alert which consumed them to do the mid lines were all internal to one chart. If I close and reopen this chart, the image is redrawn perfectly. BUT, if the alert was to read values form another chart, it cannot be in synch with that chart even if that chart is already open.

18:04 @Ensign_H: The reason is the chart opening is doing all of it study calculations right now. The global value being read will be a constant value for every bar calculation. The Other chart is not getting a chance to change the global variable. So that is the gotcha, the history of what you are attempting to do cannot be reproduced.

18:05 @Ensign_H: Now, it will work just fine in real time because charts get a chance to update tick by tick, but this too has a small gotcha. Charts get CPU time based on their order on the Z-List which is the Windows platform list of child windows. As you click on a chart to give it focus, it moves to the top of the Z-List. The Z-List can be seen by clicking menu Window, and look at the bottom of the menu list.

18:06 @Buffy 2: so click on the right order and leave it?

18:06 @Ensign_H: each of the child window will show on the list, and their position on this list will change

18:07 @Buffy 2: whoops then couldn't post

18:07 amg: ah ha...I wondered about the order of that list

18:07 @Ensign_H: and you couldn't add lines to the chart either buffy.

18:07 diego: Howard, they would work using DEMO symbol? that's the way I can reconstruct history?

18:07 @Ensign_H: the gotcha here is you might have an alert on chart B that is reading global values posted by chart B by chart A. So you expect A to post before B reads, but YOU CANNOT guarantee that is going to happen in that order because of movement on the Z-List.

 

18:09 @Ensign_H: DEMO is a playback for a single symbol, which would work fine if your other charts are using this symbol but other charts in real life might be for other symbols.

18:09 diego: ok

 

18:09 @Ensign_H: You might design a signal to read something off of INDU and off of SPX and then act on ES emini. It is flexible, and will work in real-time, but is impossible to redisplay when you reopen your workspace

18:11 amg: thanks for the in-depth explanation...no doubt once it's deployed, we'll figure out how to use in ways never imagined :)

18:12 @Ensign_H: The 2 gotchas just presented may be sufficiently frustrating to some users that they do not want to attempt any reference sharing between charts. Which is a valid concern and limitation or frustration.

18:13 @Ensign_H: amg, true words have been spoken, you all amaze me at the mansions you build from the elementary tools provided. Some of the work you all do was never in my imagination of what could be done.

18:14 @Ensign_H: the global variables is just an idea suggested and acted upon to give the program more flexibility and power in the Data Points, and Alert Object logic.

18:16 @Ensign_H: and amg, I am sure that as some ideas are attempted, new selections will need to be added to the lists to support the effort.

18:16 Rice: This referencing the other chart might be useful for alerts based on TICK or TICKI extremes, in cases where overlays wouldn't work (I'm guessing that tick or constant volume bar charts wouldn't plot those statistics properly)

18:17 @Ensign_H: For example, Min and Max were not on the lists yesterday, but that request was received by e-mail from a patron who participated in our sneak preview yesterday.

18:17 amg: hmm, interesting thought, Rice...

18:18 @Ensign_H: humm... interesting thought indeed, perhaps Alert object needs way to read a symbols current quote value directly from the quote table...

18:18 amg: right, as an example, I can't plot $VOLD onto my V1000 chart

18:19 @Ensign_H: something like Quote, TICK , last to fetch the last value for TICK directly from quote table instead of from a chart, that way a TICK and TICKI do not even have to be charts on the screen.

18:20 amg: yes, that way, one could, for instance, have 3pt break "overlay" be "normal" looking

18:20 Rice: exactly--the key word is 'current'. Ah I see. Better to reference a table directly.

18:21 amg: yes, if a table, the variable is then time or value (range, vol, tick) independent or at least could be

18:21 @Ensign_H: again, have the gotcha of not being able to back test of back plot because the alert only knows current value, and never any prior values when prior bars calculated.

18:21 Rice: given the popularity of tick charts in this group (and volume charts with yours truly), this could be quite useful

18:21 @Ensign_H: wow, have 2 hours flown by already....

18:22 @Buffy 2: amazing how time flies when you are having fun

18:22 amg: (we were being greedy and didn't let you see the clock)

18:22 @Ensign_H: guess I need to quit chatting and get to work on some of the ideas the discussion spawned.

18:23 @Ensign_H: thanks for coming, and thanks for telling your friends about Ensign Windows... we can always use more customers.

18:23 @Ensign_H: bye

18:23 @Buffy 2: bye Howard

18:23 amg: bye Howard, thanks

18:23 Rice: Thanks Howard. Pretty cool stuff.

 

19:38 @Ensign_H: hi... the question about summing volume triggered ideas for another category for Alert object

19:39 @Ensign_H: this category will be Chart Values, and have four functions of Sum, Ave, Min, and Max on 8 different data fields, many of which you can see in the screen image.

19:39 @Ensign_H: the green bars in the chart image above are the MaxHigh for last 5 highs.

19:39 @Ensign_H: This can be another great value to use in designing a signal alert.

19:40 @Ensign_H: as in a breakout signal.

19:40 @Buffy 2: looks like a good breakout signal :-)

19:41 @Ensign_H: the Number field underneath the Chart Value drop down box was set to 5 for the example, and the Bar Offset set to 0, but could have been -1 as well.

19:41 @Ensign_H: now that that set is implemented, time to go investigate the Quote Value idea that was suggested in the class.

19:41 @Buffy 2: ok Howard thanks

19:42 @Ensign_H: need to quit having class so I quit getting more ideas via feedback....lol

Addendum 11/18/04

 

14:18 @Ensign_H: The new Chart Value category has been added to include St. Dev., Regression, LRS, and Volatility.

14:19 @Ensign_H: and am excited to have the direct quote look-up category too.

14:20 @Ensign_H: So if you signal needs TICK or TIKI to be at certain levels, easy to do now with the directly look-up

 

This shows how to color bar with increasing volatility

 

16:50 @Ensign_H: have added a new category of Global Action which will allow the alert to change the global variable values and then return that value

16:51 @Ensign_H: so Value = Not Value is going to read the Boolean variable, invert its state, rewrite the variable and return the current value.

16:51 @Ensign_H: So, I used this one action to color every other bar

16:51 @Buffy 2: so if T will change to F

16:51 @Ensign_H: yes

16:52 @Ensign_H: one of the class questions on Wed was whether global variables could test for a study swing high

16:52 @Ensign_H: and now the answer is yes because the study can write a variable and the alert math can test to see if this new value is higher than Next and update Next if it is, etc.

16:54 @Ensign_H: I do not know if you will ever use that particular tool, but it is available in the arsenal of tools to make the alert object considerably more powerful

16:55 @Ensign_H: but I see a widespread resistance to learning programming code, and many of you attempt to use alert objects to do the logic.

6:57 @Ensign_H: anyway, since alerts are so commonly used now the efforts this week have been to make them much more powerful

 

6:59 @Ensign_H: this chart is a bit interesting in how color bands are created as the symbol ticks up and down in the same range.

17:01 @Ensign_H: it is color bar, but it is making horizontal bands that are colored

 


20:10 @Ensign_H: The alert property form will be easier to use now that it shows you the result for the last bar on the chart in the lower corner of the A and B panels.

20:11 @Ensign_H: in this example the Value added to the Scale Low is a value of 85.58

20:11 @Ensign_H: now you have a good clue that is in the range of values you expected and that can plot on the screen.

20:12 @Ensign_H: the graph of the green line used one other alert which I will show next.

(Note the location of the global box in the marker row has changed to the end of the row.)

0:14 @Ensign_H: the panel A calculated the Historical Volatility over a period of 10 bars

20:14 @Ensign_H: the last Volatility value was 15.28 and this was stored in Global Variable 2 but panel B then operated on that Global Variable with an action of multiplying it by 0.30

20:15 @Ensign_H: then the alert I showed earlier read value from global 2 and plotted it added to the scale low on the chart,.

20:15 @Ensign_H: 2 alerts did the study and you can start to see the power I am trying to incorporate.

20:16 @Ensign_H: panel A created it, panel B sized it, next alert then scaled it and plotted it.

20:18 @Ensign_H: and this subtle change plots the image upside down from the top scale instead of the bottom

20:18 @Ensign_H: see panel A properties

20:19 @Ensign_H: the chart object panel will show you the global variable number for those that are non zero

20:21 @Ensign_H: the first alert on the list stores in global variable 2

20:25 @Ensign_H: the innovation has added 141 new selections for the Alert Object in 5 new categories: Global Value, Global Flag, Global Action, Chart Value and Quote Value

 

Addendum 11/19/04

12:06 @Ensign_H: hi buffy, the Historical Volatility study has been implemented using a single alert object shown above, and note the 7 new marker selections that have been added, 4 larger arrows, 1 shorter horz line, and two curves, one of which was used in the example.

12:08 @Buffy 2: I like that marker - all of the new ones - thanks

12:08 @Ensign_H: panel A calculates Volatility, and stores it in Global variable 2, but panel B read global 2 and resizes by multiplying by 0.30 and adding the Scale Low..... this is then ready to be plotted by the 'B' Value as a curve.