DYO: First ocurrence of signals
|
Q: I would like to show the following condition: Once the MACD crosses above 0, I would like to show the First Time the RSI crosses 50 upwards. The vertical lines on the attached chart is where this condition existed. I do not want to be alerted for any subsequent times the RSI crosses 50. The opposite would hold true for short sales where the RSI crosses 50 downwards.
A:
Template: 1302-FirstSignal

This DYO does your tests and puts on more Green and Red arrows than you want. So a 2nd DYO will be added to mark 1st occurrence of each.
In this DYO, lets use 2 private Global Variables [250] and [251] to count the number of green arrows and red arrow, respectively. When the Green counter [250] is zero, and a green arrow it to be put on, [3] flag, then put on the green chevron to mark 1st occurrence of the green arrow. Then Line C increments the [250] counter, and Line D resets the [251] red counter.
When the Red counter [251] is zero, and a red arrow it to be put on, [7] flag, then put on the red chevron to mark 1st occurrence of the red arrow. Then Line H increments the [251] counter, and Line I resets the [250] green counter.
So the green and red chevrons happen only at the 1st occurrences you seek. You can remove the visual of the Green and Red arrows shown by the 1st DYO by unchecking the Show boxes on Lines C and F in the 1st DYO.
Template: 1302-FirstSignal
Last modified 8/26/09 2:33 PM
|