Close positions at the end of the candle
-
In this example I want at the end of the candle per hour.
Specifically in the last minute of the end of the candle, check for profits as well as pending orders
. If there is profit, if one dollar closes the profit, it will delete orders
I have developed a method and I want to know whether it is correct where when I test it on the test it does not appear to me


-
Your first image is linking an open trade (searched for that 'for each trade') to delete a pending order. Are you sure about that logic? That means those oending orders will never be deleted unless there is an open trade right now.
-
@l-andorrà said in Close positions at the end of the candle:
Your first image is linking an open trade (searched for that 'for each trade') to delete a pending order. Are you sure about that logic? That means those oending orders will never be deleted unless there is an open trade right now.
If I don’t know if the logic is correct or not? But I expect it to be true.
Let me explain it in a simple way, while the candle is at the end of the hour, in the last half a minute from the end of the open candle.
I want the expert to delete the old command, because at the beginning of the new candle another command will be opened.
This is first.
In the second picture: At the end of the hourly candle, there will be a check on profits if one dollar closes the BUY OR SELL -
In that case the first image's logic is wrong. You need an open trade to remove a pending order. That means that if there is no open trade right now, no pending order will be removed.
-
@l-andorrà said in Close positions at the end of the candle:
In that case the first image's logic is wrong. You need an open trade to remove a pending order. That means that if there is no open trade right now, no pending order will be removed.
Can you explain more what is correct, I see the request is open and has not been closed yet
-
I reread your fisrt post and I can't see you're looking for any issue to be fixed. Does your project wotrk correctly?
-
@l-andorrà Problem: I open a short trade if 3 candles in the row are bullish(vice versa)and then I want to close the trade( doesn't matter if it's at a profitable state or a losing state) I just want the trade to be closed. How do I do that? I try to close at a custom price level but it didn't work 0_1673192586456_Screenshot 2023-01-08 174259.png
-
@radvilasreklaitis Could you please open a new thread for your question. It is not related to this thread. I will reply there.