Strategy
Inputs
Backtest result are very mixed for some pair it profitable and for some pair it loss.
MQL5:
// ===== Indicators ===== bool GreenCandle = true; bool RedCandle = true; double RSIValue = fRSI(rSymbol, SelectedTimeFrame, RSI_Period, RSI_AppliedPrice, SignalStrengthValue); if(RSIValue == 0) continue; double BB_ResistanceLine_UpperBand_S0 = fBands(rSymbol, SelectedTimeFrame, BollingerBands_Period, BollingerBands_deviation, 0, BollingerBands_AppliedPrice, UPPER_BAND, 0); if(BB_ResistanceLine_UpperBand_S0 == 0) continue; double BB_SupportLine_LowerBand_S0 = fBands(rSymbol, SelectedTimeFrame, BollingerBands_Period, BollingerBands_deviation, 0, BollingerBands_AppliedPrice, LOWER_BAND, 0); if(BB_SupportLine_LowerBand_S0 == 0) continue; double MovingAverage_S0 = fMA(rSymbol, SelectedTimeFrame, MovingAverage_Period, 0, MovingAverage_Method, MovingAverage_AppliedPrice, 0); if(MovingAverage_S0 == 0) continue; double ADXStrength = fADX(rSymbol, SelectedTimeFrame, ADX_Period, MAIN_LINE, 0); if(ADXStrength == 0) continue; double ADX_PlusDI_S0 = fADX(rSymbol, SelectedTimeFrame, ADX_Period, PLUSDI_LINE, 0); if(ADX_PlusDI_S0 == 0) continue; double ADX_MinusDI_S0 = fADX(rSymbol, SelectedTimeFrame, ADX_Period, MINUSDI_LINE, 0); if(ADX_MinusDI_S0 == 0) continue; double BB_ResistanceLine_UpperBand = fBands(rSymbol, SelectedTimeFrame, BollingerBands_Period, BollingerBands_deviation, 0, BollingerBands_AppliedPrice, UPPER_BAND, SignalStrengthValue); if(BB_ResistanceLine_UpperBand == 0) continue; double BB_SupportLine_LowerBand = fBands(rSymbol, SelectedTimeFrame, BollingerBands_Period, BollingerBands_deviation, 0, BollingerBands_AppliedPrice, LOWER_BAND, SignalStrengthValue); if(BB_SupportLine_LowerBand == 0) continue; double BB_MiddleBand = fBands(rSymbol, SelectedTimeFrame, BollingerBands_Period, BollingerBands_deviation, 0, BollingerBands_AppliedPrice, BASE_LINE, 0); if(BB_MiddleBand == 0) continue; double MovingAverage_S = fMA(rSymbol, SelectedTimeFrame, MovingAverage_Period, 0, MovingAverage_Method, MovingAverage_AppliedPrice, SignalStrengthValue); if(MovingAverage_S == 0) continue; double ADX_PlusDI_S = fADX(rSymbol, SelectedTimeFrame, ADX_Period, PLUSDI_LINE, SignalStrengthValue); if(ADX_PlusDI_S == 0) continue; double ADX_MinusDI_S = fADX(rSymbol, SelectedTimeFrame, ADX_Period, MINUSDI_LINE, SignalStrengthValue); if(ADX_MinusDI_S == 0) continue; double HighS = iHigh(rSymbol, SelectedTimeFrame, SignalStrengthValue); double LowS = iLow(rSymbol, SelectedTimeFrame, SignalStrengthValue); double Close_S1 = iClose(rSymbol, SelectedTimeFrame, 1); // ===== Candle strength ===== for(int c = 1; c <= SignalStrengthValue; c++) // { double CloseS = iClose(rSymbol, SelectedTimeFrame, c); double OpenS = iOpen(rSymbol, SelectedTimeFrame, c); if(GreenCandle && CloseS <= OpenS) // not bullish GreenCandle = false; if(RedCandle && CloseS >= OpenS) // not bearish RedCandle = false; // performance shortcut if(!GreenCandle && !RedCandle) break; } // ===== Execute ===== if( //Small TrendReversal (!RelativeStrengthIndex || RSIValue < RSI_BelowLevel) && (!BollingerBands || (LowS < BB_SupportLine_LowerBand && Close_S1 < BB_MiddleBand && Close_S1 > BB_SupportLine_LowerBand_S0)) && GreenCandle && //Strong Big Trend (!MovingAverage || (rBID > MovingAverage_S0 && MovingAverage_S0 > MovingAverage_S)) && (!AverageDirectionalIndex || (ADXStrength > ADX_Strength && ADX_PlusDI_S0 > ADX_MinusDI_S0 && ADX_PlusDI_S0 > ADX_PlusDI_S)) ) { gTradeComment = IndiCatorsName + "+" + gSingleTFCheckingStatus + "+" + IntegerToString(SignalStrengthValue); gNewOrderSend = BUYORDER; NewOrderSend(); } else if( //Small TrendReversal (!RelativeStrengthIndex || RSIValue > RSI_AboveLevel) && (!BollingerBands || (HighS > BB_ResistanceLine_UpperBand && Close_S1 > BB_MiddleBand && Close_S1 < BB_ResistanceLine_UpperBand_S0)) && RedCandle && //Strong Big Trend (!MovingAverage || (rBID < MovingAverage_S0 && MovingAverage_S0 < MovingAverage_S)) && (!AverageDirectionalIndex || (ADXStrength > ADX_Strength && ADX_PlusDI_S0 < ADX_MinusDI_S0 && ADX_MinusDI_S0 > ADX_MinusDI_S)) ) { gTradeComment = IndiCatorsName + "+" + gSingleTFCheckingStatus + "+" + IntegerToString(SignalStrengthValue); gNewOrderSend = SELLORDER; NewOrderSend(); }
Inputs
MQL5:
input int SignalStrengthValue = 1; //Shift input ENUM_TIMEFRAMES SelectedTimeFrame = PERIOD_M15; input string __RSI_Indicator__ = "***RSI Indicator Settings***"; input ENUM_APPLIED_PRICE RSI_AppliedPrice = PRICE_CLOSE; input int RSI_Period = 14; input int RSI_AboveLevel = 70; input int RSI_BelowLevel = 30; input string __BollingerBands_Indicator__ = "***Bollinger Bands Indicator Settings***"; input ENUM_APPLIED_PRICE BollingerBands_AppliedPrice = PRICE_CLOSE; input int BollingerBands_Period = 20; input double BollingerBands_deviation = 2.0; input int BollingerBands_BandShift = 0; input string __MovingAverage_Indicator__ = "***Moving Average Indicator Settings***"; input ENUM_MA_METHOD MovingAverage_Method = MODE_EMA; input ENUM_APPLIED_PRICE MovingAverage_AppliedPrice = PRICE_CLOSE; input int MovingAverage_Period = 200; input int MovingAverage_MAShift = 0; input string __ADX_Indicator__ = "***ADX Indicator Settings***"; input int ADX_Strength = 10; input int ADX_Period = 100;
Backtest result are very mixed for some pair it profitable and for some pair it loss.