Help me please) I want to add exit from position in 22:00 every day and new input in the morning at 11:00.
// MA
len = input(6, minval=1, title="Length")
src = input(close, title="Source")
offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
out = sma(src, len)
plot(out, color=color.blue, title="MA", offset=offset)
price = close
x = price > out
x2 = price < out
//Logic
if (out > out[1]) and metka and x
strategy.entry("ConsUpLE", strategy.long, comment="ConsUpLE")
if (out < out[1]) and metka and x2
strategy.entry("ConsDnSE", strategy.short, comment="ConsUpLE")
You can use the
hour
function and specify any hour. Note that:1)You have to stay on intraday chart
2)
hour
function use the exchange's timezone that could differ from your's.Then use this boolean as a trigger for your exit condition