Join our fan page
- Views:
- 4345
- Rating:
- Published:
- 2017.01.19 17:03
- Updated:
- 2017.09.06 09:38
-
Need a robot or indicator based on this code? Order it on Freelance Go to 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:
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
//| 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:
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/16861

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

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

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 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.