Hi,
I have created 2 “ATR% of Close Price” Scripts, I don’t think they are working correctly?
ATR20 of current day is less than 15% of Closing Price -
- ATR(BARS=30)/CLOSE() < 15/100
- ATR(BARS=30)/CLOSE() [1] < 15/100
Thanks, Brad
Hi,
I have created 2 “ATR% of Close Price” Scripts, I don’t think they are working correctly?
ATR20 of current day is less than 15% of Closing Price -
Thanks, Brad
Hi Brad,
I suspect your premise will nearly always be achieved.
You are calculating the Average True Range of the movement of the Close price of a group of bars, which is always significantly smaller than the Close prices, and looking for that value to be less than 15% of a Close price.
As a couple of examples:
I’d also recommend bracketing your formula to ensure the correct comparison sequence of calculation:
(ATR(BARS=10)/CLOSE()) < (15/100)
I'd also simplify your formula to save an unnecessary calculation::(ATR(BARS=10)/CLOSE()) < 0.15
CheersTrevor
Hi Trevor,
Thanks for your reply, testing and advice, I will consider it in future scripting.
I thought I had a couple of exceptions but haven’t been able to find them again.
Did you think the below Script was correctly written?
ATR20 of 1 day ago is less than 15% of Closing Price –
Thanks, Brad
Hi Brad,
Just remember to add parenthesis. It’s not always needed but my OCD programming brain always wants to remove all doubt.
One way your script could be processed is
ATR(Bars=30) divided by (Close()[1] < 15/100)
Close()[1] < 15/100 will evaluate to either 1 (true) to 0 (false).
Precedence of operators should make sure that never happens but I still like to be explicit on these things. Perhaps early tesing of scripting has scared me!
Make your script
(ATR(BARS=30)/CLOSE() [1]) < 15/100
All the best
Mathew
Hi Matthew,
Thanks for your helpfull reply.
Cheers, Brad