So I am really new to programming in MQl5, I have a question about sending an order. So this is the MqlTradeRequest:
double TakeProfitOpenS, StoplossLine1S, StoplossLine2S;
if(BreakoutShort) {TakeProfitOpenS=open; StoplossLine1S=(close-open)*2+close; StoplossLine2S=(close-open)*1.8+close;}
else {TakeProfitOpenS=0; StoplossLine1S=0; StoplossLine2S=0;}
//--- Defining the BounceShort
double BounceShort = StoplossLine1S <= close <= StoplossLine2S;
//--- Stoploss for short
double slShort = Bid >= (2.5*GCdif_EMA)+close;
double slShort1 = close > StoplossLine1S;
//--- Take Profit for short
double tpShort = TakeProfitOpenS;
MqlTradeRequest request={};
request.price = SymbolInfoDouble(_Symbol,SYMBOL_BID); // Short
request.magic = EXPERT_MAGIC; // EA magic number so you can track trades
request.action = TRADE_ACTION_DEAL; // Market order
request.symbol = _Symbol; // Symbol
request.type = ORDER_TYPE_SELL; // Long
//--- request.order = "OrderTicketSell"; // The orderticket so you can trace the individual trade
request.deviation = 5; // Maximum price deviation
request.volume = 0.25; // This should be €25.000
request.tp = tpShort; // Take profit Short
request.sl = (slShort || slShort1); // Stoploss Short
request.comment = "Sell using OrderSendAsync()";
MqlTradeResult result={};
if(!OrderSendAsync(request,result))
{
Print(__FUNCTION__,": error ", GetLastError(),", retcode = ", result.retcode);
}
If this happens:
double BreakoutS = BreakoutShort && GCRB < 200;
I want to open the trade, but I have no idea where to start. If someone could tell me how I can use this to actually send an order that would be great! Thanks in advance.