To modify pending order i use
m_trade.OrderModify(TICKET,PRICE,SL,TP,ORDER_TIME_GTC,0);
for magic i use this in OnInit function
m_trade.SetExpertMagicNumber(magic1);

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
Hlw
i hv enough knowledge in mq4 programming but in mq5 i m almost new
asking some help in place order
my mq4 code here:
my mq5 code here:
#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
CPositionInfo m_position; // trade position object
CTrade m_trade; // trading object
CSymbolInfo m_symbol; // symbol info object
// ------------------- where to put magic number? if want to trade open -----------------------------------------------------
if ( conditon 1 met ) { bool tk1= m_trade.Buy(lot,m_symbol.Name(),MODE_ASK,0.0,0.0,"Buy "); }
if ( conditon 2 met ) { int tk2= m_trade.Sell(lot,m_symbol.Name(),MODE_BID,0.0,0.0,"Sell"); } // ------------------- i m in trouble in order modify code ----------------------------------------------------- for(int b=OrdersTotal()-1;b>=0;b--) { ulong ticket=OrderGetTicket(b); if(OrderSelect(ticket) ){ if(Period() == 5 && OrderGetInteger(ORDER_MAGIC) == magic1 && OrderGetString(ORDER_SYMBOL)==Symbol()){ if (OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY_STOP ){ if ( PositionGetDouble(POSITION_PRICE_OPEN)- MODE_ASK >gap*Point) { double priceNew=(MODE_ASK +gap*Point); bool kkkk = PositionModify( ticket,priceNew,0,0,PositionGetDouble(POSITION_PRICE_OPEN)); } //-------------- same also sell stop , buy and sell code required -------------------------------------------------------------- ??????????????????????????????????i cant modify pending and open orders..........so many error code after compile