Elder Impulse System
25 Feb 2019, 02:36
The Theory
The Elder Impulse System was designed by Alexander Elder and featured in his book, Come into my trading room. According to Elder, “the system identifies inflection points where a trend speeds up or slows down”. The Impulse System is based on two indicators, a 13-day exponential moving average and the MACD-Histogram The moving average identifies the trend, while the MACD-Histogram measures momentum. As a result, the Impulse System combines trend following and momentum to identify tradable impulses. https://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:elder_impulse_system
Great indicator by https://ctrader.com/users/profile/7773" https://ctrader.com/algos/indicators/show/1476
My cBot using MACD-Histogram and EMA
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class cBot : Robot
{
private ExponentialMovingAverage _EMA;
private MacdHistogram _MACD;
private Position _position;
[Parameter(DefaultValue = 1000, MinValue = 0)]
public int Volume { get; set; }
[Parameter("Period", DefaultValue = 9)]
public int Period { get; set; }
[Parameter("Long Cycle", DefaultValue = 26)]
public int LongCycle { get; set; }
[Parameter("Short Cycle", DefaultValue = 12)]
public int ShortCycle { get; set; }
[Parameter("Source", DefaultValue = 12)]
public int Source { get; set; }
[Parameter("Data Source")]
public DataSeries Price { get; set; }
protected override void OnStart()
{
_MACD = Indicators.MacdHistogram(LongCycle, ShortCycle, Period);
_EMA = Indicators.ExponentialMovingAverage(Price, Period);
}
public override void Calculate(int index);
}
protected override void OnBar()
{
if (Trade.IsExecuting)
return;
bool isLongPositionOpen = _position != null && _position.TradeType == TradeType.Buy;
bool isShortPositionOpen = _position != null && _position.TradeType == TradeType.Sell;
if (_MACD.Histogram.LastValue > _MACD.Histogram.LastValue - 1 && _EMA.Result > _EMA.Result - 1 && !isLongPositionOpen)
{
ClosePosition();
Buy();
}
if (_MACD.Histogram.LastValue > _MACD.Histogram.LastValue - 1 && _EMA.Result < _EMA.Result - 1 && !isLongPositionOpen)
{
ClosePosition();
Sell();
}
}
private void ClosePosition()
{
if (_position != null)
{
ClosePosition(_position);
_position = null;
}
}
private void Buy()
{
Trade.CreateBuyMarketOrder(Symbol, Volume);
}
private void Sell()
{
Trade.CreateSellMarketOrder(Symbol, Volume);
}
protected override void OnPositionOpened(Position openedPosition)
{
_position = openedPosition;
}
}
}
Errors, except for the last at line 88, are all infront of void at lines 43,63,72,77 and 82
#tradesafe

PanagiotisCharalampous
25 Feb 2019, 10:30
Hi jpwtrading,
These errors are caused by
public override void Calculate(int index); }But even if you fix that more errors appear. It seems you have copied and pasted things for other cBots/Indicators and it is not clear what are you trying to do. Maybe yous hould consider rewriting the strategy from start.
Best Regards,
Panagiotis
@PanagiotisCharalampous