I am willing to pay.
Hi, hope someone can help. I copied some of the code directly from the Help but when my order is placed it tries to Buy 1 instead of Sell 1. Manually works, but the EA is not. What am I doing wrong? Thanks.
Hi, hope someone can help. I copied some of the code directly from the Help but when my order is placed it tries to Buy 1 instead of Sell 1. Manually works, but the EA is not. What am I doing wrong? Thanks.
Inserted Code
if(volume>1 && !tp1Reached) { //--- setting the price level, Take Profit and Stop Loss of the order depending on its type if(type==POSITION_TYPE_BUY && position_symbol==Symbol() && high>positionPrice+takeProfit1*point2) { volume1=1; tp1Reached=true; partialClose=true; request.price=SymbolInfoDouble(position_symbol,SYMBOL_BID); request.type =ORDER_TYPE_SELL; } if(partialClose) { //--- zeroing the request and result values ZeroMemory(request); ZeroMemory(result); //--- setting the operation parameters request.action =TRADE_ACTION_DEAL; // type of trade operation request.position=position_ticket; // ticket of the position request.symbol=position_symbol; // symbol request.volume =volume1; //request.magic=EXPERT_MAGIC; // MagicNumber of the position //--- output information about the modification PrintFormat("Partial #%I64d %s %s",position_ticket,position_symbol,EnumToString(type)); //--- send the request if(!OrderSend(request,result)) PrintFormat("OrderSend error %d",GetLastError()); // if unable to send the request, output the error code //--- information about the operation PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order); partialClose=false; }