♥ 0 |
Hello Pete, I would like to add a study to a scan. The code of the study should reflect when a green candle crosses the 20 or the 50 or the 200 daily EMAs. The crossing will be valid for any price along the candle (it can cross at high, or low, or close…or the body). The attached picture shows that the scan should give a signal at number 1 (check the picture), because a green candle crossed EMA20, then another signal should be given the day after because a green candle crossed the EMA20 again. A 3rd, 4th, and 5th signals should be given in the following three days because a green candle crossed the EMA20 and 50, the EMA50, and the EMA200 in the following days respectively. I would like to mention that this is only part of my scan. My actual scan has other conditions. Thank you,
Marked as spam
|
Private answer
In addition to the 5 candles you marked in your screenshot, I counted 15 additional candles that qualified as valid signals. Just thought I would mention that in case there is something missing from your specification. I would avoid using the term “crossing” when describing your specification. On a chart, a cross occurs when price begins on one side of a level, then moves to the other side of a level. In your screenshot, candles 1, 3 and 5 are crossing. The others are not. In case you are questioning this, be sure to read all the details here. This is the authoritative source on the matter: http://toslc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/crosses.html In it’s purest form, what I see from your specification is this:
Stated from the perspective of the exponential moving averages:
What we do when we set out writing code is to ensure we understand the specifications from the perspective of the computer, rather than the human. I wanted to take the time to explain all of this because it will help you in the future when you are requesting assistance on some other matter. The code:
Marked as spam
|
Please log in to post questions.