Scrip for Red Dog Reversal


0
0

Hi Pete,

  I am wondering if you can help in wrting the script for red dog reversal.

 2 or  more consecutive up days ( number of days can be configurable) and alert triggers if the following criteria are me price goes above the prior day’s high and Price trades back down through that price.

 

Thank you

Sam

 

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 19, 2020 5:37 pm
576 views
0
Private answer

The only ambiguity in your specification is "...and price trades back down through that price...". There are two ways this can be possible. To begin, both involve checking if the high of current bar is higher than previous bar. Stage two of this element is where we have options. We can check if the bar also closed below that level (trades back down through that price). Or we can check if the low of that bar is less than that level (trades back down through that price). Both of these scenarios will fit your specification.

So what I have provided here is the first of those two options:

input numberOfBars = 2;
def upBar = close > open;
def triggerBar = Lowest(upBar[1], numberOfBars) > 0 and high > high[1] and close < high[1];

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on February 20, 2020 8:19 am