Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Telegram !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Bibliothèque

SignalCandelsHighOpen - bibliothèque pour MetaTrader 5

Vues:
3861
Note:
(16)
Publié:
2017.01.19 17:03
Mise à jour:
2017.09.06 09:38
\MQL5\Include\Expert\MySig\
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

The entire chain: Candels High Open indicator, Expert Advisor based on the CandelsHighOpen signal module. 

The SignalCandelsHighOpen module of trading signals assumes that the Candels High Open custom indicator has already been compiled and placed to \MQL5\Indicators\. This path is specified in the module of the next code block:

//+------------------------------------------------------------------+
//| Create the "Candels High Open" indicator                         |
//+------------------------------------------------------------------+
bool CSignalCHO::CreateCandelsHighOpen(CIndicators *indicators)
  {
//--- pointer check
   if(indicators==NULL) return(false);
//--- add the object to the collection
   if(!indicators.Add(GetPointer(m_SignalCHO)))
     {
      printf(__FUNCTION__+": failed to add CandelsHighOpen object");
      return(false);
     }
//--- set Candels High Open indicator parameters
   MqlParam parameters[2];
//---
   parameters[0].type=TYPE_STRING;
   parameters[0].string_value="Candels High Open.ex5";
   parameters[1].type=TYPE_INT;
   parameters[1].integer_value=m_reverse_signals;  // reverse
//--- object initialization  
   if(!m_SignalCHO.Create(m_symbol.Name(),m_period,IND_CUSTOM,2,parameters))
     {
      printf(__FUNCTION__+": failed to initialize CandelsHighOpen object");
      return(false);
     }
//--- number of buffers
   if(!m_SignalCHO.NumBuffers(1)) return(false);
//--- reaching this string means the function is executed successfully - return 'true'
   return(true);
  }

If the indicator is placed to another folder, like \MQL5\Indicators\Examples\, the path to the indicator is as follows:

   parameters[0].string_value="Examples\\Candels High Open.ex5";

Buy and sell signals:

Since the Candels High Open indicator contains only three values in its buffer:

  • "+1" - buy signal
  • "0" - no signal
  • and "-1" - sell signal
The trading signals module does the same:

//+------------------------------------------------------------------+
//| Return the buy signal power                                      |
//+------------------------------------------------------------------+
int CSignalCHO::LongCondition()
  {
   int signal=0;
//--- for working by ticks idx=0, for working by complete bars idx=1
   int idx=StartIndex();
//--- signal values on the last complete bar
   double ind_value=Signal(idx);
//---
   if(ind_value>0.0)
     {
      signal=100; // a buy signal is present
     }

//--- return the signal value
   return(signal);
  }
//+------------------------------------------------------------------+
//| Return a sell signal power                                       |
//+------------------------------------------------------------------+
int CSignalCHO::ShortCondition()
  {
   int signal=0;
//--- for working by ticks idx=0, for working by complete bars idx=1
   int idx=StartIndex();
//--- signal values on the last complete bar
   double ind_value=Signal(idx);
//---
   if(ind_value<0.0)
     {
      signal=100; // a sell signal is present
     }

//--- return the signal value
   return(signal);
  }

When generating an EA via the MQL5 Wizard, search for the signal module with the "Analyzing High and Open of the last three bars" description:

SignalCandelsHighOpen

 

Traduit du russe par MetaQuotes Ltd.
Code original : https://www.mql5.com/ru/code/16861

Candels High Open Candels High Open

Candels High Open indicator analyzes High and Open of the last three bars.

Zigzag2_R_Color_Arrows_HTF Zigzag2_R_Color_Arrows_HTF

The Zigzag2_R_Color indicator with the timeframe selection option in the input parameters and display of values as fractal labels.

CandelsHighOpen CandelsHighOpen

CandelsHighOpen Expert Advisor is based on the Candels High Open indicator trading signals module. The EA features trading market and pending orders, as well as trailing stop based on Parabolic SAR.

Original Turtle Rules Trader Original Turtle Rules Trader

Original Turtle Rule Trader Expert Advisor implements a trading system described in the book "The Original Turtle Trading Rules". The EA code implements the visual display of the three Donchian channels, money management, opening and adding trades and moving stop levels.