@mohamed80 Hi Mohamed, try changing all your candle ID's to 1, 0 is the current candle so it will only ever have a split second to catch the candle close.
In this link is how to do an if statement, NAME & RESULT are variables, what you have written above can be put into MX code but probably easier to store data, if you wat to do a formula in custom code then like XL you put it in brackets as you did above, E.G (1+9)/8)}.
Hope this helps
