//+------------------------------------+ //| TRUE_SCALPER | //+------------------------------------+ // // This is the one used successfully by Jean-François // // Designed for M5 but I attached it to M15 and it worked fine. // long if EMA3>EMA7:::EMA350) RSIPOS=true; else RSINEG=false; if(RSI<50) RSIPOS=false; else RSINEG=true; OrdersPerSymbol=0; for(cnt=OrdersTotal();cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if( OrderSymbol()==Symbol() ) { OrdersPerSymbol++; } } // calculate TakeProfit and StopLoss for //Ask(buy, long) slBUY=Ask-(StopLoss*p); tpBUY=Bid+(TakeProfit*p); //Bid (sell, short) slSEL=Bid+(StopLoss*p); tpSEL=Ask-(TakeProfit*p); // so we can eventually do trailing stop //if (TakeProfit<=0) {tpBUY=0; tpSEL=0;} //if (StopLoss<=0) {slBUY=0; slSEL=0;} // place new orders based on direction // only of no orders open if(OrdersPerSymbol<1) { // not sure if this should be POS or NEG if(bull>bear && RSINEG) { OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),"Buy Order placed at "+CurTime(),0,0,White); //(Symbol(),OP_BUY,Lots,Ask,Slippage,slBUY,tpBUY,"ZJMQCIDFG",11123,0,White); return(0); } // not sure if this should be POS or NEG if(bull ProfitMade*p ) { OrderClose(OrderTicket(),Lots,Bid,0,White); return(0); } } // if BUY if(OrderType()==OP_SELL) { // did we make our desired SELL profit? if( OrderOpenPrice()-Ask > (ProfitMade*p) ) { OrderClose(OrderTicket(),Lots,Ask,0,Red); return(0); } } //if SELL } // if(OrderSymbol) } // for // ---------------- TRAILING STOP if(TrailingStop>0) { OrderSelect(0, SELECT_BY_POS, MODE_TRADES); if((OrderType() == OP_BUY || OrderType() == OP_BUYSTOP) && (OrderSymbol()==Symbol())) { if(TrailingStop>0) { if(Bid-OrderOpenPrice()>Point*TrailingStop) { if(OrderStopLoss()0) { if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) { if(OrderStopLoss()==0.0 || OrderStopLoss()>(Ask+Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice (),Ask+Point*TrailingStop,OrderTakeProfit(),0,Aqua); return(0); } } } } } return(0); } // start()