How to setup a FLAG in the expert

 

Hi All,

I'm having some dificulties to set up a FLAG in my expert that defines if the trade has already been triggered or not.

For instance, I have a order logic that is triggered when the RSI indicator is overbought or oversold. All orders have S/L and T/P. If one of this two targets is reached, my order is closed. And this is my problem. If I close an order (by S/L or T/P) and my logic is still triggered (the market is still overbought or oversold) I don't want to open another order. I want to inform the EA that an order has already been opened and closed.

Any idea?

Thanks

 
 

Thanks gjol. Just one question:

At a S/L and T/P event the OrderClose price will always be equal to OrderStopLoss or OrderTakeProfit price?

 
gcardo:

Thanks gjol. Just one question:

At a S/L and T/P event the OrderClose price will always be equal to OrderStopLoss or OrderTakeProfit price?


if your broker is a ECN it's not necessarily It can also be a different price
 

but You can check if the position is plus or minus (OrderProfit())

 

Thanks qjol

But my problem will persist if i have different prices for S/L - T/P or Close Order. Known if the order had a positive or negative result doesn't help either, because I don't want the EA to open any new order, no matter what happened before.

I thought in a global variant which records the FLAG( was trade or not before). But I don't know how to do this

 

But known if the trade happens is what really matters afterall!. Just need to check if a trade was done with the especific magic number. If yes, don't trade anymore.

Thanks for your help. It helped my think further.

 
That's it thanks
Reason: