How can I get the buy signal earlier?
Posted: Sat Feb 19, 2022 5:27 pm
In the picture, you see the entry signal of a pullback strategy. It's a daily chart.
My problem is, that the entry signal appears with a delay (when candle has opend at the next day).
I would like to get the signal before the market closes. I tried to changed everything with "close" in the script below to "open", but that doesn't worked.
What can I do that the signal comes at the same day without a delay?
My problem is, that the entry signal appears with a delay (when candle has opend at the next day).
I would like to get the signal before the market closes. I tried to changed everything with "close" in the script below to "open", but that doesn't worked.
What can I do that the signal comes at the same day without a delay?
Code: Select all
//@version=5
strategy('pullback', overlay=true)
if close > ta.sma(close, 200) and close < ta.sma(close, 21)
strategy.entry('long', strategy.long)
//Declaring percentage numbers
SL = 0.10
TP = 0.08
//Calculating the exit price for sl and tp
longstop = strategy.position_avg_price * (1 - SL)
longprofit = strategy.position_avg_price * (1 + TP)
//for long positions
if strategy.position_size > 0
strategy.exit(id='close', stop=longstop, limit=longprofit)
sma1 = ta.sma(close, 21)
sma2 = ta.sma(close, 50)
plot(sma1)
plot(sma2)