//+------------------------------------------------------------------+ //| projectRecent.mq4 | //| Moe D | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Moe D" #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int start() { //Lets define the variables int ticket1, ticket2 ,iSlipPage,iSLPips,iTPPips,randomFlip; double dStopLoss, dTakeProfit,dLots; string sText,sArrow; iSLPips=200; //Stop Loss in Pips iTPPips=400; //Take Profit in Pips dLots=1; //Amount of Lots iSlipPage=3; sText="My Order"; //Order Text sArrow=CLR_NONE; //Order Arrow Color dStopLoss=Bid-NormalizeDouble(iSLPips*Point,MarketInfo(Symbol(),MODE_DIGITS)); dTakeProfit=Ask + NormalizeDouble(iTPPips*Point,MarketInfo(Symbol(),MODE_DIGITS)); randomFlip = (1 + rand() %2);// assign randomly pick the numbers 1 or 2 if (randomFlip == 2){ //the coin landed on head therefore, we buy long bool ticket1=false; ticket1=OrderSend(Symbol(),OP_BUY,dLots, Ask,iSlipPage,dStopLoss, dTakeProfit,sText,000,0,sArrow); } else{ //the coin landed on tails, therefore, we buy short bool ticket2=false; ticket2=OrderSend(Symbol(),OP_SELL,dLots, Ask,iSlipPage,dStopLoss, dTakeProfit,sText,000,0,sArrow); } if(ticket1<0||ticket2<0) { Print("OrderSend failed with error #",GetLastError()); } return(0); }