Times must be bad if I cannot see the wood for the trees!
The following code should give me data about the open position for the chart pair BUT I get data for a different chart pair... why??
On the GBP chart the comment gives correctly the chart pair but the order symbol and data are for AUD ... how can that be when it should not enter the "if(OrderSymbol() == Symbol()) " section ??
PRIZE to whoever answers correctly first .... Free day off from trading on Christmas day :-)
Happy Christmas everyone.
TIA.
M.
The following code should give me data about the open position for the chart pair BUT I get data for a different chart pair... why??
On the GBP chart the comment gives correctly the chart pair but the order symbol and data are for AUD ... how can that be when it should not enter the "if(OrderSymbol() == Symbol()) " section ??
PRIZE to whoever answers correctly first .... Free day off from trading on Christmas day :-)
Happy Christmas everyone.
Inserted Code
void UpdateOpenTrades() { int c, mOrdTotal; bool mOp; mOrdTotal = OrdersTotal(); for(c = mOrdTotal - 1; c >= 0; c--) { mOp = OrderSelect(c, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() == Symbol()) && OrderMagicNumber() == mMagicN) { if(OrderType() == OP_BUY || OrderType() == OP_SELL) { DelPending(); Comment(Symbol(), " ", OrderSymbol(), " ", OrderType(), " ", DoubleToStr(OrderLots(), 2)); if(OrderType() == OP_BUY) mTradeData[0] = 1; else mTradeData[0] = 2; mTradeData[1] = OrderOpenTime(); mTradeData[2] = OrderTicket(); mTradeData[5] = NormalizeDouble(OrderLots(), mLotSizeDigits); if(iTime(NULL, 1440, 0) > OrderOpenTime()) { if(TimeDayOfWeek(iTime(NULL, 1440, 0)) != 1) { mTradeData[3] = iHigh(NULL, 1440, 1); mTradeData[4] = iLow(NULL, 1440, 1); } else { mTradeData[3] = iHigh(NULL, 1440, 2); mTradeData[4] = iLow(NULL, 1440, 2); } } if(mTradeData[0] == 1) { mTradeData[6] = NormalizeDouble(OrderOpenPrice() - OrderStopLoss(), mLotSizeDigits); } else { mTradeData[6] = NormalizeDouble(OrderStopLoss() - OrderOpenPrice(), mLotSizeDigits); } mOpenUpdated = true; } // if BUY/SELL } // if Symb if(mOp != true) { int mError = GetLastError(); Alert(Symbol(), " Error UpdateOpen = ", ErrorDescription(mError)); } } // for c return; }
TIA.
M.
If you think I'm mad, I must be mad