Dzwehao:
You MUST use OrderSelect() before using OrderTicket(), OrderLots() etc . . . read the documentation . . . "Note: The order must be previously selected by the OrderSelect() function."Even when I use : OrderSelect() before OrderTicket(), OrderLots() , the close condition above is not taken into account ; the order run until the TakeProfit limit .
What error does your OrderClose() generate ? you are checking aren't you ?
Thank very much for your answer.
Actually, since I was not able to do it correctly, I was not sure if it was possible to Close the Order before it reach its Takeprofit limit.
I started back from the "MACD sample" and I deleted not usefull information; I've setup my one condition => it works well.
For now don't understand why it didn't work at first, since I tought I was applying the right rules, I still have to work deeper on that.
Thank again.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Dear
I’m new on MT4.
I’ve been trying for many days to Close an open Order (which has been set up with a take profit limit), before the TakeProfit limit is reach.
My initial command is :
OrderSend(Symbol(), OP_SELL ,Lots ,Bid ,3 ,0 , Bid-TakeProfit*Point, NULL ,16384,0,Red);
I have a Close condition for example :
If ( ( SignalPrevious > 0 ) && (SignalCurrent < 0) )
{
….
OrderClose(OrderTicket(), OrderLots(), Ask , 3 ,Violet );
….
}
Even when I use : OrderSelect() before OrderTicket(), OrderLots() , the close condition above is not taken into account ; the order run until the TakeProfit limit .
Could someone help me.
Thank in advance
Best regards