Warning: All rights on these materials are reserved by MetaQuotes Software Corp. Copying or reprinting of these materials in whole or in part is prohibited.
Great article but...How does the following line apply to using this code?:
Warning: All rights on these materials are reserved by MetaQuotes Software Corp. Copying or reprinting of these materials in whole or in part is prohibited.
Please don't worry. You can freely use all codes attached to articles. Otherwise, authors wouldn't attach them. But, if you're going to mention this article anywhere, you must make a proper reference to it. That's all.
Sincerely.
Interesting article Andre. Your method of obtaining closed reason is by inspection of order comment.
Is this 100% generic solution that will apply to brokers where I can trade using EA's?
This is important to know otherwise failure is likely.
If cannot warranty that order comment will be modified and thus your method is used then is there method which uses closed order data fields: profit, openPrice,closePrice, TP,SL,closeTime,expiryTime... ?
Thank you Andre.
Interesting article Andre. Your method of obtaining closed reason is by inspection of order comment.
Is this 100% generic solution that will apply to brokers where I can trade using EA's?
It is better to analyse a OrderClosePrice():
if ( MathAbs( OrderClosePrice() - OrderStopLoss() ) < Point ) // closed by SL if ( MathAbs( OrderClosePrice() - OrderTakeProfit() ) < Point ) // closed by TP
Hi, is it possible to retrieve the Order information (i.e. ticket number, closed price ...) when an event is triggered?
int start() { CheckEvents( MagicNumber ); OrderInfoObj orderInfo; if ( (orderInfo = eventBuyClosed_SL) > 0 ) Alert( Symbol(), ": Buy position was closed by StopLoss!", orderInfo.ticket, orderInfo.closedPrice ... ); .... return(0);
}
Awsome article, Thank you sir!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Events in МetaТrader 4 has been published:
Author: Andrey Khatimlianskii