I wish to trade when price touches sma as same value as sma , not next bar open.
Ex. 30min timframe and if price is spot on (sma 20) LIVE, i want it to bye or sell
Is this possible?
You cannot if you only use the 30-minute TF.
It’s possible if you use Multi Time Frame support. It will allow you to use also a lower TF, down to even 1 second, so you can detect that occurrence as soon as it happens.
Searching the forum for MTF or Multi Time Frame, will return you videos, articles and examples about it.
You can also put pending orders on the SMA price levels: (LIMIT if you are above, or STOP if you are below).
sma = average[20]
if close > sma then
buy at sma limit
elsif close < sma then
buy at sma stop
endif