TradeStation EasyLanguage quick-tip 65 | Number of bars after cross
Quick-tip 65 demonstrates two simple of ways of finding and showing when a condition on the chart has occurred within a user input number of bars.
The quick-tip shows two ways that this can be programmed. The condition used to facilitate the demonstration is the cross of a fast moving average over a slow moving average.
Using a counter
This first technique is used in the TradeStation indicator: _Quick-tip65-Counter. In this program a counter indicator is incremented by one every bar. When the fast moving average crosses over a slow moving average the counter is reset to zero. The program draws an asterisk when the value of the counter is less than a user input value, i.e. when the cross had occurred less that that number of bars ago.
Setting a variable
In the second technique (_Quick-tip65-Condition) a variable is set to a value of 1 every time the fast moving average crosses over a slow moving average, otherwise is is set to zero. The summation function is used to check whether the sum of this variable over the user input number of bars is greater than zero. If so an asterisk is drawn on the chart.
In this example, the asterisks are displayed vertically.
-
7:38
GoodKidProductions
17 hours agoPharma's Secret Censorship Squad w/ Lee Fang
11.5K7 -
7:09
SaturdayMorningInspection
16 hours agoBengals Leadership Just Made A Really Smart Move
14.4K1 -
9:52
Hannah Barron
17 hours agoMy New House Is Coming Along!
7.21K18 -
6:52
ryanhoguepassiveincome
12 hours agoHow to Identify Future Trends As They Happen
6.7K1 -
1:33
Precision Rifle Network
16 hours agoCompetition Rifle Case by Cole-Tac!
10.8K1 -
1:42:28
AlphaNewsMN
5 months ago $10,923.61 earnedThe Fall of Minneapolis
4.29M2.16K -
8:51:57
Jerry After Dark
15 hours agoJerry After Dark: Breaking A World Record
56.9K6 -
2:44:33
Price of Reason
17 hours agoWill Deadpool & Wolverine SAVE Disney? Elon's NEW TV App, DEI & GamerGate 2 Update w/ Dreadroberts
28.3K9 -
5:07:22
RiceGum
10 hours agoWE LIVE! COME CHILL TACO TUESDAY
50.9K18 -
5:13:09
SNEAKO
13 hours agoBIG DRAMA: Keith Woods, Zherka E-Date
178K104