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.
-
8:29
ParisDemers
20 hours agoThe Kratos/God Of War Workout Program (His Real-Life Training)
5.71K3 -
16:14
CarlCrusher
15 hours agoSkinwalker's Evil Twin - Beyond Skinwalker Ranch Behind the Scenes Season 1 ep 2
6.88K2 -
58:35
Crime Circus
21 hours agoMackenzie Shirilla KlDNAPPED!! True Crime Documentary!
8.23K6 -
12:00
DepressedGinger
12 hours agoLibs *MELTDOWN* as Biden sh*ts himself again...
8.9K10 -
8:03
Bearing
18 hours agoE-Safety Karen INVENTS Elon Musk HARASSMENT While LEAKING Private Details!
17.2K73 -
17:16
Clownfish TV
23 hours agoMedia Melting Down Over Mainstream Media Meltdown...
38.7K56 -
1:11
Gamazda
16 hours agoFlight of the Bumblebee - Rimsky-Korsakov
42.5K48 -
1:00:21
MYLUNCHBREAK CHANNEL PAGE
17 hours agoA Little Season in New York City
58.8K108 -
11:56
China Uncensored
18 hours agoThe Philippines Threaten War with China
51.2K38 -
33:00
Degenerate Jay
22 hours agoThe James Bond Games Have Been Lost To Time
27.2K7