Adding TradeVolumeIndex to existing cbot
Adding TradeVolumeIndex to existing cbot
29 Jun 2020, 04:15
Morning,
I am having trouble adding the indicator TradeVolumeIndex to one of my existing cbots, code snippet:
#region Indicator declarations
private SimpleMovingAverage sma1 { get; set; }
private RelativeStrengthIndex rsi { get; set; }
private TradeVolumeIndex tvi { get; set; }
#endregion
#region cTrader events
protected override void OnStart()
{
// construct the indicators
sma1 = Indicators.SimpleMovingAverage(SourceSma1, PeriodsSma1);
rsi = Indicators.RelativeStrengthIndex(RSISource, RSIPeriods);
tvi = Indicators.TradeVolumeIndex;
}
Getting the following error message on the construct for the TradeVolumeIndex indicator, not sure I understand this.
Error CS0428: Cannot convert method group 'TradeVolumeIndex' to non-delegate type 'cAlgo.API.Indicators.TradeVolumeIndex'. Did you intend to invoke the method?
This is an example of how I wish to use the indicator.
if (tvi.Result.IsFalling())
{
ClosePosition(TradeType.Buy);
}
Much appreciate if someone could give me some of their experience on this issue.
Many thank
Brian
PanagiotisCharalampous
29 Jun 2020, 10:11
Hi bdouglas,
Check here how to reference a custom indicator.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous