I saw my post was in the wrong place so here it is in the right section:
Hi, I have a little error in my logic, but I can not seem to see what it is.
print an uparorow if:
3 red candles are followed by a green candle OR (2 red candles followed by an indicision candle are followed by a green candle).
Print an down arrow if :
3 green candles are followed by a green candle OR (2 green candles followed by an indicision candle are followed by a red candle).
Definition of an indicision candle: the body is less than 20% of the total candle
Also the setup candle (candle i) should have a body of at least 50% of the total candle
Could anybody please help me on why there is an arrow placed in the right side of the screen in the picture?
From what I can see is that the candle before the "setup candle" (candle before the one that has the arrow) is not an indicision candle.
please help :)
( (Close[i+1]<Open[i+1]) || (((Open[i+1]-Close[i+1])/ (High[i+1]-Low[i+1])*100)<20))
If you have a green candle, Open-Close will be negative, so you can have a -30, -40...
You need to take absolute value :
( (Close[i+1]<Open[i+1]) || ((MathAbs(Open[i+1]-Close[i+1])/ (High[i+1]-Low[i+1])*100)<20))
Thank you, I do see that taking absolute values solve the problem, but now I see that I also have an array out of range error which I did not had with my original code (attached).
Why does this happen, and how could I solve this?
Thanks in advance!
(Sorry it might be a stupid question, but I have been out of the programming for a few months and try to use my original code)
Please enable the necessary setting in your browser, otherwise you will not be able to log in.