AI
Volume based cbot
06 Feb 2019, 14:07
Hi All, currently looking into creating a Volume based cbot. If anyone out there has explored Volume related type of indicators would appreciate any feedback.
Cheers.
Alberto
Replies
afhacker
06 Feb 2019, 17:45
Try my "Advanced Volume" indicator:
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using System;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None, AutoRescale = true)]
public class AdvancedVolume : Indicator
{
#region Fields
private double _lastPriceValue;
private MovingAverage _bullishVolumeMa, _bearishVolumeMa;
#endregion Fields
#region Parameters
[Parameter("Use Live Data", DefaultValue = false)]
public bool UseLiveData { get; set; }
[Parameter("Show in %", DefaultValue = true)]
public bool ShowInPercentage { get; set; }
[Parameter("MA Periods", DefaultValue = 10)]
public int MaPeriods { get; set; }
[Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
public MovingAverageType MaType { get; set; }
[Parameter("Use Average For Delta", DefaultValue = false)]
public bool UseAverageForDelta { get; set; }
#endregion Parameters
#region Outputs
[Output("Bullish Volume", Color = Colors.Lime, PlotType = PlotType.Histogram, IsHistogram = true, Thickness = 5)]
public IndicatorDataSeries BullishVolume { get; set; }
[Output("Bearish Volume", Color = Colors.Red, PlotType = PlotType.Histogram, IsHistogram = true, Thickness = 5)]
public IndicatorDataSeries BearishVolume { get; set; }
[Output("Bullish Volume MA", Color = Colors.DarkGreen, PlotType = PlotType.Line)]
public IndicatorDataSeries BullishVolumeMa { get; set; }
[Output("Bearish Volume MA", Color = Colors.DarkRed, PlotType = PlotType.Line)]
public IndicatorDataSeries BearishVolumeMa { get; set; }
[Output("Delta", Color = Colors.Yellow, PlotType = PlotType.Line)]
public IndicatorDataSeries Delta { get; set; }
#endregion Outputs
#region Methods
protected override void Initialize()
{
_lastPriceValue = MarketSeries.Close.LastValue;
_bullishVolumeMa = Indicators.MovingAverage(BullishVolume, MaPeriods, MaType);
_bearishVolumeMa = Indicators.MovingAverage(BearishVolume, MaPeriods, MaType);
}
public override void Calculate(int index)
{
if (IsLastBar && UseLiveData)
{
if (MarketSeries.Close.LastValue > _lastPriceValue)
{
double volume = double.IsNaN(BullishVolume[index]) ? 1 : BullishVolume[index] + 1;
BullishVolume[index] = ShowInPercentage ? volume / MarketSeries.TickVolume[index] : volume;
}
else if (MarketSeries.Close.LastValue < _lastPriceValue)
{
double volume = double.IsNaN(BearishVolume[index]) ? -1 : BearishVolume[index] - 1;
BearishVolume[index] = ShowInPercentage ? volume / MarketSeries.TickVolume[index] : volume;
}
_lastPriceValue = MarketSeries.Close.LastValue;
}
else
{
double barRange = MarketSeries.High[index] - MarketSeries.Low[index];
double percentageAboveBarClose = -(MarketSeries.High[index] - MarketSeries.Close[index]) / barRange;
double percentageBelowBarClose = (MarketSeries.Close[index] - MarketSeries.Low[index]) / barRange;
BullishVolume[index] = ShowInPercentage ? percentageBelowBarClose : MarketSeries.TickVolume[index] * percentageBelowBarClose;
BearishVolume[index] = ShowInPercentage ? percentageAboveBarClose : MarketSeries.TickVolume[index] * percentageAboveBarClose;
}
BullishVolumeMa[index] = _bullishVolumeMa.Result[index];
BearishVolumeMa[index] = _bearishVolumeMa.Result[index];
Delta[index] = UseAverageForDelta ? BullishVolumeMa[index] - Math.Abs(BearishVolumeMa[index]) : BullishVolume[index] - Math.Abs(BearishVolume[index]);
}
#endregion Methods
}
}
@afhacker

ClickAlgo
06 Feb 2019, 16:19
Hi Alberto,
You can try our free WeisWave Volume indicator by following the link below, also, we are signing up a new vendor who is offering this type of indicator as part of a trading strategy, I will send you details once it is published.
https://clickalgo.com/ctrader-weis-wave-indicator
Paul Hayes
Sales & Marketing
Email: contact@clickalgo.com
Phone: (44) 203 289 6573
Website: https://clickalgo.com
Twitter | Facebook | Google+ | YouTube | Pinterest | LinkedIn
@ClickAlgo