Pinescript strategy.entry long/short seem delayed by an additional 2 candles

Viewed 2748

When I enter a strategy.entry position, when I look at the graph that shows the color change for a condition, the actual buy order does not execute until the third candle of the color and vice versa when selling, i.e., it is the third red candle before the sell strategy is executed.

If I can change the color of the indicator in a plot in one candle, it seems like I should be able to execute a strategy.entry in the same candle.

Any ideas on why there is a delay in the strategy being executed?

1 Answers

Try using process_orders_on_close=true in the first line of the strategy function. You can take reference of this link Help needed with strategy - Entry is off by 2 candles. Even if problem not resolved then the possible solution is to make the exact same strategy in study.

Related