I am trying to create a strategy that acts as the Moving up % / Moving down % function of the alerts, as shown in the image. The problem is that I can't find any function that allows me to replicate that behavior inside a strategy.enter image description here
I have tried to create a strategy so that every time a candle opens, I place a limit order X % away (so that the trade is opened before the candle closes in the strategy) and cancel the limit order (in case the price has not been reached) when the candle closes.
--- Edit:
What I had thought of for backtesting a strategy is the following:
1-Each time a candle opens, a Limit order is placed at X% of the price at which the candle opened. 2-Being a limit order, TV executes the strategy.entry even if the candle has not closed yet and would have the position to which to set a TP and a SL in the strategy.exit. 3-If the price did not reach the level of that limit order, the limit order is cancelled when the candle closes. 4-Repeat the process from step 1.
I tried to do it, but I have not succeeded, evidently my knowledge of Pine Script is not enough. That's why I asked this question, to see if someone knows how to do it?