Need Help please, nothing is happening New comment Kerkad 2019.10.24 09:41 #include <Trade\Trade.mqh> CTrade trade; int a =0; void OnTick() { double RsiArray[]; int rsi = iRSI(_Symbol,PERIOD_CURRENT, 14, PRICE_CLOSE); ArraySetAsSeries(RsiArray,true); CopyBuffer(rsi,0,0,3, RsiArray); double rsivalue=NormalizeDouble(RsiArray[0],2); double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits); double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits); if(rsivalue<40) { a=5; trade.Buy(0.10,NULL,(Ask-1000*_Point),(Ask+500*_Point),NULL); CheckTrailingStop(Ask); } if(rsivalue>60) { a=10; trade.Sell(0.1,NULL,(Bid-1000*_Point),(Bid+500*_Point),NULL); CheckTrailingStop1(Bid); } Comment(a); } //+------------------------------------------------------------------+ void CheckTrailingStop(double Ask) { double SL=NormalizeDouble(Ask-150*_Point,_Digits); for (int i=PositionsTotal()-1;i>=0;i--) { string symbol=PositionGetSymbol(i); if (Symbol()==symbol) { ulong PositionTicket=PositionGetInteger(POSITION_TICKET); double CurrentStopLoss=PositionGetDouble(POSITION_SL); if (CurrentStopLoss<SL) { trade.PositionModify(PositionTicket,(CurrentStopLoss+10*Point()),0); } } }} void CheckTrailingStop1(double Bib) { double SL=NormalizeDouble(Bib+150*Point(),Digits()); for (int i=PositionsTotal()-1;i>=0;i--) { string symbol=PositionGetSymbol(i); if (_Symbol==symbol) { ulong PositionTicket=PositionGetInteger(POSITION_TICKET); double CurrentStopLoss=PositionGetDouble(POSITION_SL); if (CurrentStopLoss<SL) { trade.PositionModify(PositionTicket,(CurrentStopLoss-10*_Point),0); } } }} Hi guys, I wanted to test Stop Loss Function, so i use this simple code. But nothing is happening. During the backtest no buy or sell order Can you help me please Thank you for your time Help for sl Help me please, i need to change the returned value of a function is a new condition happens The Operator "return" New comment
Hi guys,
Can you help me please
Thank you for your time