#include //Create an instance of Ctrade CTrade trade; void OnTick() { //we calculate the ask price double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK),_Digits); //We calculate the bid price double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits); //Create a string for the signal string signal=""; //Create an array for the price data double myRSIArray[]; //define the propherties for the RSI int myRSIDefinition = iRSI(_Symbol,_Period,14,PRICE_CLOSE); //Defined EA, from current candle, for 3 candles, save in array CopyBuffer(myRSIDefinition,0,0,3,myRSIArray); //Calculate the current RSI value double myRSIValue=NormalizeDouble(myRSIArray[0],2); if (myRSIValue>70) signal="sell"; if (myRSIValue<30) signal="buy"; //Sell 10 micro lotes if (signal =="sell" && PositionsTotal()<1) trade.Sell(0.001,NULL,Bid,(Bid+200*_Point),(Bid-150*_Point),NULL); //Buy 10 micro lotes if (signal =="buy" && PositionsTotal()<1) trade.Buy(0.001,NULL,Ask,(Ask+200*_Point),(Ask-150*_Point),NULL);// //Char output Comment("The signal is now: ",signal); } //+------------------------------------------------------------------+