Two consecutive daily up candles scan


Category:
0
0

I am trying to write an EOD scan in thinkscript to find positions that have two consecutive daily up candles, with the second day candle being at least twice as big as the previous one. I was thinking maybe a percentage adjustable volume increase from the first day to the second. Any help would be greatly appreciated. I am just learning the basics of thinkscript.

Thank you

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on December 20, 2018 2:04 pm
1342 views
0
Private answer

There were a few items left out for which I had to make my own choices. On the chart, an “up candle” is determine strictly by the position of the open and the close. If the candle closes higher than it opens, the chart colors that candle green. Even if that candle had gapped down and actually closed lower than the previous candle’s close. So I wrote the code to ensure we capture both. Two green candles, each with higher closes.

The other item you did not specify clearly is: “with the second day candle being at least twice as big as the previous one”. So I was not sure if you wanted to include the high and low in that test or just the body of the candle, the open to close. In this code I chose to use just the candle body.

The requirement for a volume percent change is provided for through a user input in the very first line of code. The default value is 10.0 and that means 10%. So enter whatever whole value percent change you want and the code does the math accordingly.

Here is the code. I have not tested this.

input percentVolumeIncrease = 10.0;
def twoHigherCloses = close[2] < close[1] and close[1] < close; def twoUpCandles = close[1] > open[1] and close > open;
def bodyRange = close - open;
def doubleSize = bodyRange > bodyRange[1] * 2;
def volumeIncrease = volume > volume[1] * (1 + (percentVolumeIncrease * 0.01));
plot scan = twoHigherCloses and twoUpCandles and doubleSize and volumeIncrease;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on December 22, 2018 10:25 am
0
re: Here is the code. I have not tested this. Verified as working /jjc Thank you Pete
( at October 26, 2019 10:33 pm)