Description
Hola,
Una vez calculado el volumen alcista y el volumen bajista el siguiente paso es calcular el volumen neto e incluso, acumularlo por periodos.
La finalidad del estudio es comprobar si el volumen confirma el movimiento del precio.
Número de periodos igual a uno:
Numero de periodos igual a quince:
Adios.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Frequency3 : Indicator
{
[Parameter(DefaultValue = 15)]
public int periods { get; set; }
[Output("Result1", LineColor = "Aqua", PlotType = PlotType.Histogram)]
public IndicatorDataSeries Result1 { get; set; }
private double volume, range, close, result;
private IndicatorDataSeries bullVolume, bearVolume;
protected override void Initialize()
{
bullVolume = CreateDataSeries();
bearVolume = CreateDataSeries();
}
public override void Calculate(int index)
{
volume = Bars.TickVolumes[index];
range = Bars.HighPrices[index] - Bars.LowPrices[index];
close = Bars.ClosePrices[index] - Bars.OpenPrices[index];
result = close / range * volume;
if (result > 0)
{
bullVolume[index] = result;
bearVolume[index] = result - volume;
}
if (result < 0)
{
bullVolume[index] = volume + result;
bearVolume[index] = result;
}
if (result == 0)
{
bullVolume[index] = volume / 2;
bearVolume[index] = -volume / 2;
}
Result1[index] = bullVolume.Sum(periods) + bearVolume.Sum(periods);
}
}
}
srm_bcn
Joined on 01.09.2019
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Frequency3.algo
- Rating: 5
- Installs: 1110
- Modified: 13/10/2021 09:54
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.