Download MetaTrader 5

Expert Advisors: MQL5 Wizard - Trade Signals Based on Morning/Evening Stars + RSI

To add comments, please log in or register
Automated-Trading
Admin
102590
Automated-Trading  

MQL5 Wizard - Trade Signals Based on Morning/Evening Stars + RSI:

The MQL5 Wizard allows creating ready-made Expert Advisors based on the Standard library classes delivered together with the client terminal (see Creating Ready-Made Expert Advisors in MQL5 Wizard for the details). It allows to check your trade ideas quickly, all you need is to create your own trading signals class. The structure of this class and example can be found in the article MQL5 Wizard: How to Create a Module of Trading Signals.

The generic idea is the following: the class of trading signals is derived from CExpertSignal, the next, it's necessary to override the LongCondition() and ShortCondition() virtual methods with your own methods. 

There is a book "Strategies of best traders" (in Russian), there are many trading strategies are considered there, we will focus on reversal candlestick patterns, confirmed by Stochastic, CCI, MFI and RSI oscillators.

The best way is to create the separate class, derived from CExpertSignal for checking of formation of candlestick patterns. For confirmation of trade signals, generated by candlestick patterns, it's sufficient to write the class, derived from CCandlePattern and add the necessary features (for example, confirmation by oscillators) there.

Here we will consider the signals, based on "Morning Star/Evening Star" (Morning Doji Star/Evening Doji Star) reversal candlestick patterns, confirmed by RSI indicator. The module of trade signals is based on the CCandlePattern class, it's simple example of its use for creation of trade signals with candlestick patterns.

"Morning Star" and "Morning Doji Star" candlestick patterns

"Evening Star" and "Evening Doji Star" candlestick patterns

Testing results of the Expert Advisor, based on Morning/Evening Stars + RSI

Author: MetaQuotes Software Corp.

Stephen Njuki
5206
Stephen Njuki  

Optmisable Patterns...

Once you've assembled your EA you may want to replace


input int                Inp_Signal_SignalCustomPatterns_CCI_LongPattern = 1;
input int               Inp_Signal_SignalCustomPatterns_CCI_ShortPattern = 2;


with


//---3 white soldiers & black crows are an example... it could be any other signal
input ENUM_LONG_CANDLE_PATTERNS                Inp_Signal_SignalCustomPatterns_CCI_LongPattern =CANDLE_PATTERN_THREE_WHITE_SOLDIERS;
input ENUM_SHORT_CANDLE_PATTERNS               Inp_Signal_SignalCustomPatterns_CCI_ShortPattern=CANDLE_PATTERN_THREE_BLACK_CROWS;
pathall
3
pathall  

I am trying to put together a simple EA using the sample code supplied by including the "aCandlePatters.mqh" but there appears to be an error in the class as I keep getting "invalid pointer access in 'aCandlePatterns.mqh' (66,64)" error message and in the journal initializing of test_EA (AUDUSD,H4) failed. I have tried everything but the problem persists. Any tips or assistance would be appreciated. Thks

 https://www.mql5.com/en/code/321 



Zhang Zhang
131
Zhang Zhang  

bool CCandlePattern::CheckPatternPiercingLine()
  {
//--- Piercing Line
   if((Close(1)-Open(1)>AvgBody(1)) && // long white
      (Open(2)-Close(2)>AvgBody(1)) && // long black
      (Close(2)>Close(1))           && // close inside previous body <<< should be "(Close(1)>Close(2)", i think>>>

      (Close(1)<Open(2))            && 
      (MidOpenClose(2)<CloseAvg(2)) && // downtrend
      (Open(1)<Low(2)))                // close inside previous body
      return(true);
//---
   return(false);
  }

Stefano Oddo
29
Stefano Oddo  
This EA  close itself order?
To add comments, please log in or register