hi all, I'm creating a bot using Python and mql5, I have a doubt, I want to let the script open a trade, and if that trade hit TP or SL it opens a new trade, is it possible? I can't find the variable to use in comparison I think it's ORDER_REASON_TP but I don't quite understand how to implement could you help me?
- Experts: Manual Hedging
- MQL5 and Python in Metaquotes VPS
- Can python be use to create trade copier EA?
#include <Trade\DealInfo.mqh> CDealInfo m_deal; void OnTradeTransaction(const MqlTradeTransaction& trans, const MqlTradeRequest& request, const MqlTradeResult& result) { if(trans.type==TRADE_TRANSACTION_DEAL_ADD) { if(HistoryDealSelect(trans.deal)) m_deal.Ticket(trans.deal); else return; long reason=-1; m_deal.InfoInteger(DEAL_REASON,reason); if(reason==DEAL_REASON_TP) { // open new trade here } } }
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