In-depth discussion of the November 2004 Newsletter alerts. Global Flags and Variables

November 24 , 2004.

 

16:34 @Ensign_H: You can install Beta in any folder you wish, however, you will be different than everyone else and that makes it harder on my support staff. I do not understand this reluctance to install in the default C:\Ensign folder and just replace the older version that you may have installed there. The upgrade overwrites only the program and the Help documentation. All your configured files remain the same.

16:34 tradinoncoffee: also, you can backup prior to downloading

 

16:34 @Ensign_Kimball: Good afternoon. We will be starting a training class shortly. Hope you all have a nice Holiday. Howard will be demonstrating several new features that have been added to Ensign Windows this past week.

16:36 @Ensign_H: hi... we sure have been busy here at Ensign Software implementing lots of new ideas that expand the power of the Alert Objects.

16:37 @Ensign_H: There have been over 175 new selections added to the alert object grouped in 5 categories. The categories that were added are Global Value, Global Flag, Global Action, Chart Value and Quote Value.

16:38 @Ensign_H: Also, some new markers have been added to the bottom of the Marker list. This includes another set of arrows that are larger in size, and a Curve marker which is useful for plotting study values.

16:39 @Ensign_H: Another major enhancement is the addition of a new sub-window with special characteristics where it is divided horizontally into 6 sections. The alert objects can color these sections and post text or values to the section.

16:40 @Ensign_H: Some of this will be illustrated in the class today.

16:41 @Ensign_H: All of the examples we cover in class require the Beta version of Ensign Windows. We are doing a beta phase because the enhancements have been major. The ONLY way to get the beta is to use your web browser to download it directly from our web site. The link for the Nov 24 beta version is on the Download page. You click that link and then open the file it will download. The title plate will show 11-24-04 as the date when the program runs.

16:42 @Ensign_H: Now lets get going with the good stuff.

16:43 @Ensign_H: All of the examples for the class today have been uploaded as templates on my web site.

16:43 @Ensign_H: T here are 4 new templates, and you can download these templates and follow along using the Beta version of the program. The way to download a template is click menu File | Open | Internet Services. Click the Upgrade tab...top left

16:44 @Ensign_H: Click the Template bullet and use the drop down box to select the template name. Then click the Download button. This will put the template file and its documentation in your template folder. The new template will show on your Template list and can be applied to a chart.

 

Relative Strength Index Trend

www.ensignsoftware.com/tips/tradingtips59.htm

16:46 @Ensign_H: The template for this is RSI-Trend.

16:45 @Ensign_H: To start with, use the scroll bar in the viewer above to move down to the first article.

16:46 @Ensign_H: Download instructions are found at the bottom of the first article, so scroll down a bit farther to see an example of getting the template.

16:47 @Ensign_H: You can read the introductory material about the rules for the Trend indicator.

16:47 @Ensign_H: There are basically two rules for the Up Trend and two rules for the Down Trend. The Up Trend begins when the RSI crosses above 70 and continues until is falls below 40. The Down Trend begins when RSI crosses below 30 and continues until is rises above 60.

16:48 @Ensign_H: These rules were implemented using 6 alert objects, and these we will cover in class so you can get your questions answered if you have any confusion.

16:49 @Ensign_H: The chart shows green and red zones to indicate when the Up Trend or Down Trend is in effect.

16:50 @Ensign_H: Four of the alerts simply watch RSI being above or below some threshold.

16:50 @Ensign_H: See the 1st alert example parameter form which is True when RSI is above 70.

16:50 @Ensign_H: That was one of the conditions for the Up Trend indicator.

16:51 @Ensign_H: That is a simple alert. I happened to use the green block positioned at the top of the RSI sub-window to show when this alert kicks in.

16:52 @Ensign_H: OK, the last 2 alerts are more complex and they are both shown. The first of them does the Up Trend zone coloring. Move the viewer down to show this alert property form.

16:53 @Ensign_H: Panel A returns the number of bar since this alert was true, and the alert watched is the RSI > 70 alert.

16:54 @Ensign_H: Panel B watches the ending boundary of when the Up Trend is to turn off by going below 40.

16:54 @Ensign_H: If the cross above 70 is a more recent event, its Bars Since value will be a smaller number.

16:55 @Ensign_H: Thus we can use the Bar Since values from A and B to know which event happened in which order.

16:55 @Ensign_H: If the >70 event is more recent we must still be in the Up Trend, and will color the Zone green.

16:56 @Ensign_H: Viola, this is a slick solution for keeping track of the timing of two different events.

16:56 @Ensign_H: Any questions about this clever use of the Bars Since True to implement our Up Trend logic?

16:58 @Ensign_H: Now scroll down to see the last alert property form This 6th alert implements the logic for the Down Trend.

17:00 @Ensign_H: If the <30 event is more recent than the >60 event, then the Down Trend must still be in progress and this alert will color the zones Red. Again, it greatly simplifies keeping track of switches that start something and stop something.

Bars since true is a great way to measure the sequence of two events to know which one first and which one second. Like light switch

If we measure the time then you can use that measurement to know which event is the most recent

most recent will be fewer number of bars.

Light on or off - Time as to which event last to know the state of the light

17:00 @Ensign_H: Again, it greatly simplifies keeping track of switches that start something and stop something.

17:02 diego: also you can track time since enter a trade

17:02 @Ensign_H: yes diego, that would be a good use of the Bars Since True feature

17:03 diego: like it

17:06 diego: like the light of the stairs :-)

 

Study Consensus (Same name for template through internet services)

17:06 @Ensign_H: ok, lets move on to the 2nd example, scroll the newsletter view down to the next article.

17:07 @Ensign_H: Read the introduction about the Study Consensus. Basically this example will treat each of 3 studies as voting elves. When all 3 agree on buying a Buy signal is shown.

17:08 @Ensign_H: When all 3 agree on selling, a Sell signal is shown.

17:08 Wayne: Is it limited to just these three studies

17:08 @Ensign_H: the clever part of this example is to save the T/F result of each alert in separate global variables that are in sequence.

17:09 @Ensign_H: No, wayne, 3 was shown but the idea of counting the elves is easily extended by using more global variables each holding a True or a False.

17:10 @Ensign_H: The first alert tests the Buy/Sell vote of the Average study and stores the answer in Global Variable 2

17:10 alipang: thanks for the extension, really appreciate it

17:10 @Ensign_H: Note on the Write Variable entry is a 2 on the right side of the Marker frame.

17:10 @Ensign_H: The result is just the panel A value since A Only is the condition.

17:11 @Ensign_H: This result happens to be a boolean, so a boolean is stored in variable 2.l

17:11 @Ensign_H: Another clever part of this alert is the Position selection of Section 1. The Section 1 through 6 are new selections found at the bottom of the Position drop down list.

17:12 @Ensign_H: These will use a new sub-window that shows above the time stamp grid.

The color for the section will be the True color if the alert is True and the Show True box is checked. The color of the section will be the False color if the alert result is False and the Show False box is checked.

17:13 @Ensign_H: On this first alert, both Show True and Show False are checked, so the Section 1 will always be showing and show with either Green or Red background.

17:14 @Ensign_H: Now we can optionally show text in this section by having text on the Message line.

17:15 @Ensign_H: Both a True message and a False message can be entered together separated by a vertical line., Note that the message is MA Buy|MA Sell.

17:15 @Ensign_H: the MA Buy on the left of the vertical line is the message to show for True and the text following the vertical line is the message to show for False.

17:16 @Ensign_H: If you scroll to the bottom of the article you will see chart examples with the Sections colored with messages at the bottom of the chart.

17:16 @Ensign_H: This is going to be a great way to have some visual image of what studies or Signals are doing right now.

17:18 @Ensign_H: I am teaching how the alert objects can be used to determine consensus among studies to arrive at a composite Signal.

17:19 @Ensign_H: You can tweak the study parameters, or use your own studies, or bar formations, etc, to create your quorum of voting elves.

17:19 @Ensign_H: the next couple of alerts implement the visual sections for the Sto Momentum elf, and the RSI elf.

17:19 @Ensign_H: The RSI is a bit different in that it has 3 states.

17:20 @Ensign_H: It votes Buy when RSI is above 60 and Sell when below 40

17:20 @Ensign_H: but there is the 3rd possibility that RSI is in the neutral state between 40 and 60.

17:20 @Ensign_H: That is why 2 alerts were needed to implement its Section visual.

17:20 @Ensign_H: One alert will color section 3 green when RSI is above 60

17:21 @Ensign_H: A 2nd alert will color section 3 red when RSI is below 40

17:21 @Ensign_H: and if neither is doing the coloring, the section remains uncolored which will be our neutral indication.

17:22 @Ensign_H: Scroll down to the alert that show Count True in the A panel. This is where more clever stuff has been added.

17:23 @Ensign_H: The category is Global Flag, and the action is to count a sequence of global variables to see how many are holding a true value.

17:23 @Ensign_H: The number of variables to count is 3, set in the Number field.

17:23 @Ensign_H: If you want more elves, put their results in additional global variables and change the Number size for the count extent.

17:24 @Ensign_H: The Global Variable value is the starting point in the array of global variable.

17:24 @Ensign_H: So this counts 3 variables starting at variable 2.

17:24 @Ensign_H: If the count is 3, then that means that all 3 elves voted True.

17:25 @Ensign_H: The result of the test is to compare the count with the number in panel B which is 3.

17:25 tradinoncoffee: if other charts in the workspace are placing values from their charts into global variables, is it possible to have more that three trues and compromise the signal?

17:25 @Ensign_H: good question tradingoncoffee...... and basically the answer for this particular alert is NO.

17:26 @Ensign_H: nothing needs to be remembered like in our previous example.

17:26 @Ensign_H: When a chart does its calculate, all of the alerts will write their global values, and get counted and do the visual of the Sections.

17:27 @Ensign_H: And the process would be repeated when the next calculate for this chart.

17:27 @Ensign_H: Another chart could do the same thing, and not bother the behavior.

17:28 @Ensign_H: There might be some times however, when you are trying to store something for a LATER reference, and then you must be careful not to destroy the value put in the global variable by some other chart.

17:28 @Ensign_H: That is not the case in this particular template, however.

17:29 @Ensign_H: Ok, when the count is 3 True elves, we color section 6 with the BUY message.

17:29 @Ensign_H: Note that we do not do any coloring when the 3 elf count is not 3

17:29 @Ensign_H: we use the next alert to do the section coloring to Red when the 3 elves vote to sell.

17:30 @Ensign_H: That alert to count sell votes is the next alert shown in the viewer.

17:30 @Ensign_H: Two of the elves indicate Sell by having a False in variables 2 and 3.

17:31 @Ensign_H: However the RSI had 3 states, if you member, and the True state to Buy was in variable 3.

17:31 @Ensign_H: I used variable 1 to indicate when the RSI votes to sell and to match the other 2 alerts, I used False in variable 1 to indicate the Sell vote.

17:32 @Ensign_H: Therefore, we can count the false votes in variables 1, 2, and 3 to see if all three studies agree to sell.

17:32 @Ensign_H: so this was a good example to include RSI with 3 states and show how I handled this study

17:32 tradinoncoffee: so there are really 4 variables in this template

17:33 @Ensign_H: that could Buy, Sell or be neutral.

17:33 @Ensign_H: yes tradingoncoffe.

17:33 @Ensign_H: and seeing that I needed 4 I planned ahead to have the Buy votes be in 2, 3, and 4 and the Sell votes be in 1, 2 and 3

17:34 @Ensign_H: So RSI uses 1 and 4 by being on either side of the 2 and 3

17:34 @Ensign_H: 2 and 3 were always one way or the other type elves.

17:34 @Ensign_H: but RSI was a 3 state elf

17:35 @Ensign_H: anyway, this shows a bit of cleverness.

17:35 @Buffy2: really appreciate you picking ones that show how to think them through

17:35 mmaker: Planning ahead where those variables go is VIP. When does the software actually calculate and process the alerts, at the beginning of the next bar or every x seconds?

17:36 @Ensign_H: mmaker, the alerts have a Close Only check box and if that property is checked, they would calculate once per bar when a bar closes because we see a new tick that needs to start a new bar. If the Close Only is unchecked, then the alerts calculate with every tick.

17:37 @Ensign_H: This also show why it helps on the chart to have the Optimize Speed box checked which when checked will skip recalculation when the price did not change.

17:37 mmaker: ah that's what that is for thx Howard

17:37 Rice: What's the easiest way to keep track of what's parked in each global variable address? just write them down as you go?

17:38 @Ensign_H: Rice, on the chart objects list we will show the global variable that is written by this study immediately ahead of the study name on the list. So that helps keep track of which alert is writing to which variable.

17:39 Rice: I was hoping you might say that. Good solution

17:39 @Ensign_H: Now, though this example does not show it, we have another feature that will help

17:40 @Ensign_H: oft times you would like to print the value from the global variable as part of the Section text.

17:40 @Ensign_H: On the right side of the Message frame there is a Read Variable spinner box.

17:41 @Ensign_H: When the spinner is non zero, we will read the global variable and show it as part of the message in the Section windows.

17:41 @Ensign_H: I think I posted some examples yesterday where I was showing study values in the section windows.

17:42 @Ensign_H: With a message like RSI = and then the value from the global variable that the RSI study wrote directly to.

17:42 @Ensign_H: You can have the study save its value to a global variable by selecting the variable on the study property form. Together it works pretty slick and makes for a nice bar of study values with colored backgrounds.

17:42 Rice: so you'd do this if you wanted to show, say just one or two study values instead of all of them.

17:42 @Ensign_H: sure. We could have had the studies write values to other global variables, such as 10 through 13. And then added those study values to the message text in sections 1, 2 and 3.

17:44 @Ensign_H: the color can still be the red and green for their vote, and you could see the study value in the Section panel as well. So not hard to add it to the template you downloaded.

17:44 Rice: hmm, could you use this feature to create an enhanced time and sales window right on the chart?

17:45 bearhook: Can they be set for any bounded indicator?

17:45 @Ensign_H: That is not the RSI value. That is the True flag

17:45 @Ensign_H: you need to store RSI value from the RSI study in a different global variable.

17:45 Rice: guess it would be a single line that updated

17:45 @Ensign_H: The variables 1 through 4 are storing boolean flags, not study values in my example.

17:46 bearhook: So this RSI study isn't based-upon the hi/lo threshold values?

17:46 @Ensign_H: this RSI is based on the rules listed at the top of the article.... vote to buy when RSI > 60

17:46 @Ensign_H: and vote to sell when RSI < 40

17:48 Tricky: # added to studies

17:49 @Ensign_H: You can scroll to the bottom of the article to see when all elves agree to Sell and all agree to Buy and what it looks like visually when they disagree, or don't vote as can be the case for RSI.

17:50 @Ensign_H: Tricky, may I suggest that you append a space at the end of the True and False message sections. That way there will be a space between the Sell and the study value. And, you can resize the height of the Section sub-window like you do any sub-window, click in the window and drag vertically up or down. Or you can eliminate the Buy and Sell words since that is reflected in the color of the section.

17:51 Rice: How do you type the vertical bar between the true and false message sections?

17:51 @Buffy2: the key to the left of back space key on my keyboard |

17:52 @Ensign_H: the vertical line is the shift state of the backslash key, just below the Backspace key

17:52 Rice: thx

17:53 @Ensign_H: great tricky, I think you will find ways to fall in love with the new Section positions for your alert information presentation.

17:54 Tricky: sure am Howard, it's better then what I asked for

 

Historical Volatility (Template name - Historical-Volatility)

17:55 @Ensign_H: www.ensignsoftware.com/tips/tradingtips59.htm

17:55 @Ensign_H: The 3rd example shows how to plot values using the Alert object.

17:56 @Ensign_H: You can study out how we get a value in one panel, and size it for plotting on a chart scale in the panel B, and use the new curve marker.

17:56 @Ensign_H: So, this one alert plotted Historical Volatility.

17:57 @Ensign_H: It is a good example to show how values can be rescaled to they will plot.

 

17:57 tradinoncoffee: if I wanted to take the MA signal for two different time frames and combine them on a third chart...how would that be done...we can discuss later

17:57 @Ensign_H: can discuss it now tradingoncoffe.

17:57 tradinoncoffee: ok

17:58 @Ensign_H: the idea is to have chart AA and chart BB each have their studies store in different global variable - such as 21 for AA and 31 for BB

17:58 @Ensign_H: now on one of the charts you can read the values from the global variables

17:58 @Ensign_H: use the category Global Variable and the selection Value

17:59 @Ensign_H: use the Global Variable spinner set to 21 to read that variable or to 31 to read that variable. Thus you are reading values posted by other chart.

18:00 @Ensign_H: The charts did not have to find each other, or know anything about the other chart. Each chart is just pushing its data to global variables and then it is unaware of who is reading these values.

18:00 tradinoncoffee: so I would have 2 different templates...AA and BB also?

18:00 @Ensign_H: yes about 2 templates

18:01 @Ensign_H: otherwise both charts push to the same global values and overwrite what was supposed to be waiting for somebody to read.

18:01 Rice: You know, Howard, that approach to the multiple chart issue is truly elegant. wtg

18:01 @Ensign_H: This is a good discussion of overlay you need to be careful to watch for.

18:01 tradinoncoffee: and a third actually, which reads the other 2? that is if the results are to be posted on a third chart

18:02 @Ensign_H: sure, and this is a good time to discuss a gotcha related to reading other charts.

18:03 @Ensign_H: chart AA is going to calculate across all its bars.

18:03 @Ensign_H: Then chart BB is going to calculate across all its bars.

18:03 @Ensign_H: the two may want values from each other, but there is NO WAY to time sync in the history these calculate sequences. SO THE ONLY thing you can do is watch it in real-time and your studies will then be able to fetch values pushed to global variables by other charts. It will work and show correctly in real-time but look like it is not working in hindsight when a chart opens or resizes which causes a full recalculate.

18:05 @Ensign_H: the calculate events across all bars would only see the current state of the global variables and NOT their states tick by tick back in the data sets.

18:06 @Buffy2: yes playback works well for testing - excellent class

18:08 diego: One interesting thing also is the ability to store global variables to use in ESPL

18:08 @Ensign_H: yes, diego, we are not there yet with ESPL but will expand ESPL to support the new global variable.s

18:09 diego: it would be excellent

18:10 trendtrader: thanks for talking us through a few examples of these new tools Howard, I have much to learn in the coming weeks

18:10 tradinoncoffee: thanks Howard

18:11 trendtrader: nice space saving tip

 

18:12 Tricky: Howard, if I want to use the Pesavento swing high/low into global variables, don't I need an extra box there ?
Harvest the same information by using study values/flags and store in global variable.
will look into adding it to Pesavento Patterns

18:14 Tricky: that's ok for now, maybe a small thing to add in a next update, thanks

 

18:13 Ray: Looks like I got alot of things to learn this weekend,,,just got things set up,,

18:14 Rice: diego, you can now do an amazing number of things *without* espl..

18:16 vwman: @Ensign_H, is Ensign using CPU on part of study not checked but lines in boxes

18:17 @Ensign_H: yes vwman. It uses CPU to do all calculations whether the check boxes for showing the lines is a separate issue.

18:17 vwman: so best to clear all those excesses

18:18 @Ensign_H: That affects graphics, not calcs. Yes, it would help to not plot stuff you do not need.

18:18 vwman: ok thanks

18:18 @Ensign_H: plotting uses CPU cycles too and the plot might be more than the calculate.

18:19 @Ensign_H: I think of them as equal burdens, but do not know for sure which is a greater CPU burden

18:21 @Ensign_H: Thanks for coming to class today, and enjoy the new innovations.

18:21 Ray: this class is every Wed,,,,correct

18:22 @Buffy2: yes ray and they are archived. Link is on dacharts home page.

18:22 Ray: ok, thanks Buffy

18:22 @Ensign_H: If you have questions, problems, or suggestions, drop me an e-mail with the details.

18:24 bearhook: Thanks, Howard...

18:24 dblue: You too Howard,and many thanks

18:25 Ray: thanks Buffy and Howard for your help the past few days