//+------------------------------------+ //| TRUE_SCALPER | //+------------------------------------+ // Designed for 5 but I attached it to 15 and it worked fine. // long if EMA3>EMA7:::EMA3=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if( OrderSymbol()==Symbol() ) { return(0); } } // calculate TakeProfit and StopLoss for //(B)id (sell, short) and (A)sk(buy, long) slA=Ask-(p*StopLoss); tpA=Ask+(p*TakeProfit); slB=Bid+(p*StopLoss); tpB=Bid-(p*TakeProfit); if (TakeProfit<=0) {tpA=0; tpB=0;} if (StopLoss<=0) {slA=0; slB=0;} bull=iMA(3,MODE_EMA,1); bear=iMA(7,MODE_EMA,1); RSIPOS=iRSI(2,2)>50; RSINEG=iRSI(2,2)<50; vars: sl(0),tp(0); vars: cnt(0); vars: OpenTrades(0); vars: i(0); Define: ProfitMade(2); OpenTrades = 0; lobar=LOW[Lowest(MODE_LOW,19,19)]; highbar=HIGH[Highest(MODE_HIGH,19,19)]; For i = 1 to TotalTrades { if OrderValue(i,VAL_SYMBOL) = Symbol then OpenTrades++; }; If OpenTrades<1 then { If bull>bear and RSINEG then { sl= lobar-1*Point; //(ask-(StopLoss*point)); tp=(bid+(TakeProfit*point)); SetOrder(OP_BUY,Lots,ask,slippage,sl,tp,blue); exit; }; If bullbear and RSINEG then { sl=lobar-1*point; //(ask-(StopLoss*point)); tp=(bid+(TakeProfit*point)); SetOrder(OP_BUY,Lots,ask,slippage,sl,tp,blue); exit; }; if bull < bear and RSIPOS then { sl= highbar+1*point;//(bid+(StopLoss*point)); tp=(ask-(TakeProfit*point)); SetOrder(OP_SELL,Lots,bid,slippage,sl,tp,red); exit; }; }; for cnt=1 to TotalTrades { If Ord(cnt,VAL_TYPE)=OP_BUY and Ord(cnt,VAL_SYMBOL)=Symbol then { If (Bid-Ord(cnt,VAL_OPENPRICE))>(ProfitMade*Point) then { CloseOrder(OrderValue(cnt,VAL_TICKET),Ord(cnt,VAL_LOTS),Ord(cnt,VAL_CLOSEPRICE),0,BlueViolet); Exit; }; }; If Ord(cnt,VAL_TYPE)=OP_SELL and Ord(cnt,VAL_SYMBOL)=Symbol then { If (Ord(cnt,VAL_OPENPRICE)-Ask)>(ProfitMade*Point) then { CloseOrder(OrderValue(cnt,VAL_TICKET),Ord(cnt,VAL_LOTS),Ord(cnt,VAL_CLOSEPRICE),0,Purple); Exit; }; }; }; /////Direction Change for cnt=1 to TotalTrades { If Ord(cnt,VAL_TYPE)=OP_BUY and Ord(cnt,VAL_SYMBOL)=Symbol then { If bull < bear then { CloseOrder(OrderValue(cnt,VAL_TICKET),Ord(cnt,VAL_LOTS),Ord(cnt,VAL_CLOSEPRICE),0,BlueViolet); Exit; }; }; If Ord(cnt,VAL_TYPE)=OP_SELL and Ord(cnt,VAL_SYMBOL)=Symbol then { If bull < bear then { CloseOrder(OrderValue(cnt,VAL_TICKET),Ord(cnt,VAL_LOTS),Ord(cnt,VAL_CLOSEPRICE),0,Purple); Exit; }; }; }; // ---> HERE is where you determine when to BUY //if (i1>BuyLevel) // { // OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,slA,tpA,"ZMRLQVYX",11123,0,White); // } // ---> HERE is where you determine when to SELL //if (i2