Description
Just to say hi to those who blocked me, and sent a bomb =)
Is the candle True or False Volume ? Now you know =)
Enjoy for Free =)
Previous account here : https://ctrader.com/users/profile/70920
Contact telegram : https://t.me/nimi012
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class VolumePulsev21 : Indicator
{
[Parameter("Lower Timeframe Volume Cumulation", DefaultValue = "Minute")]
public TimeFrame TF { get; set; }
[Parameter("Period", DefaultValue = 1)]
public int Period { get; set; }
[Parameter("Lower Timeframe Volume Cumulation", DefaultValue = MovingAverageType.Weighted)]
public MovingAverageType MaType { get; set; }
[Output("Volume Delta Plus", LineColor = "Lime")]
public IndicatorDataSeries VolumeDeltaPlus2 { get; set; }
[Output("Volume Delta Min ", LineColor = "Red")]
public IndicatorDataSeries VolumeDeltaMin2 { get; set; }
[Output("Histo Plus", LineColor = "Lime", PlotType = PlotType.Histogram)]
public IndicatorDataSeries HistoUp { get; set; }
[Output("Histo Min ", LineColor = "Red", PlotType = PlotType.Histogram)]
public IndicatorDataSeries HistoDown { get; set; }
private Bars barsTick;
private DateTime prevBars;
private MovingAverage smoothvolumPlus, smoothvolumMinus;
private IndicatorDataSeries resvolumPlus, resolumMinus;
private IndicatorDataSeries VolumeDeltaPlus, VolumeDeltaMin;
private double barsCount;
private int pct = 0;
private int nbBarsLast;
private bool isLastB;
protected override void Initialize()
{
barsTick = MarketData.GetBars(TF);
if (!IsBacktesting)
{
while (barsTick.OpenTimes[0] > Bars.OpenTimes[0])
barsTick.LoadMoreHistory();
}
prevBars = Bars.OpenTimes.Last(0);
resvolumPlus = CreateDataSeries();
resolumMinus = CreateDataSeries();
VolumeDeltaPlus = CreateDataSeries();
VolumeDeltaMin = CreateDataSeries();
smoothvolumPlus = Indicators.MovingAverage(resvolumPlus, Period, MaType);
smoothvolumMinus = Indicators.MovingAverage(resolumMinus, Period, MaType);
pct = 0;
barsCount = Bars.Count;
nbBarsLast = 0;
isLastB = false;
Bars.BarOpened += Bars_BarOpened;
barsTick.BarOpened += BarsTick_BarOpened;
}
private void BarsTick_BarOpened(BarOpenedEventArgs obj)
{
nbBarsLast++;
isLastB = true;
}
private void Bars_BarOpened(BarOpenedEventArgs obj)
{
nbBarsLast = 0;
isLastB = true;
}
public override void Calculate(int index)
{
barsCount = Bars.Count;
if (index == 0) return;
var index1 = barsTick.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
if (Bars.OpenTimes.Last(0) != prevBars || isLastB)
{
double deltaVolumePlus = 0.0;
double deltaVolumeMin = 0.0;
double countDeltaPlus = 0;
double countDeltaMinus = 0;
int nbBars = 0;
DateTime BarsTick = barsTick.OpenTimes[index1];
if (!isLastB)
for (int i = 0; Bars.OpenTimes[index - 1] < BarsTick; i++)
{
BarsTick = barsTick.OpenTimes[index1 - i];
nbBars++;
}
for (int i = 0; i < (isLastB ? nbBarsLast : nbBars); i++)
{
double prevClose = barsTick.OpenPrices[index1 - i];
double currentClose = barsTick.ClosePrices[index1 - i];
double volume = barsTick.TickVolumes[index1 - i];
double pipsizeUp = Math.Abs(barsTick.ClosePrices[index1 - i] - barsTick.LowPrices[index1 - i]) / (barsTick.HighPrices[index1 - i] - barsTick.LowPrices[index1 - i]);
double pipsizeDown = Math.Abs(barsTick.HighPrices[index1 - i] - barsTick.ClosePrices[index1 - i]) / (barsTick.HighPrices[index1 - i] - barsTick.LowPrices[index1 - i]);
if (currentClose > prevClose)
{
deltaVolumePlus = deltaVolumePlus + volume * pipsizeUp;
//countDeltaPlus++;
}
else if (currentClose < prevClose)
{
deltaVolumeMin = deltaVolumeMin + volume * pipsizeDown;
//countDeltaMinus++;
}
}
resvolumPlus[index] = deltaVolumePlus / Bars.TickVolumes.Last(0);
resolumMinus[index] = deltaVolumeMin / Bars.TickVolumes.Last(0);
VolumeDeltaPlus[index] = smoothvolumPlus.Result.Last(0);
VolumeDeltaMin[index] = smoothvolumMinus.Result.Last(0); ;
VolumeDeltaPlus2[index] = VolumeDeltaPlus[index] / (VolumeDeltaMin[index] + VolumeDeltaPlus[index]);
VolumeDeltaMin2[index] = VolumeDeltaMin[index] / (VolumeDeltaMin[index] + VolumeDeltaPlus[index]);
}
if (Bars.ClosePrices[index] > Bars.OpenPrices[index])
{
Chart.RemoveObject("VolumeDowntxt" + index);
Chart.RemoveObject("VolumeDown" + index);
Chart.DrawTrendLine("VolumeUp" + index, index, (Bars.ClosePrices[index] - Bars.OpenPrices[index]) * (VolumeDeltaPlus[index] / (VolumeDeltaMin[index] + VolumeDeltaPlus[index])) + Bars.OpenPrices[index], index, Bars.OpenPrices[index], Color.Lime, 5);
Chart.DrawText("VolumeUptxt" + index, ((VolumeDeltaPlus[index] / (VolumeDeltaMin[index] + VolumeDeltaPlus[index])) * 100).ToString("F0"), index, Bars.HighPrices[index] + 5 * Symbol.PipSize, Color.Lime);
}
else if (Bars.ClosePrices[index] < Bars.OpenPrices[index])
{
Chart.RemoveObject("VolumeUptxt" + index);
Chart.RemoveObject("VolumeUp" + index);
Chart.DrawTrendLine("VolumeDown" + index, index, Bars.OpenPrices[index] - (Bars.OpenPrices[index] - Bars.ClosePrices[index]) * (VolumeDeltaMin[index] / (VolumeDeltaPlus[index] + VolumeDeltaMin[index])), index, Bars.OpenPrices[index], Color.Red, 5);
Chart.DrawText("VolumeDowntxt" + index, ((VolumeDeltaMin[index] / (VolumeDeltaMin[index] + VolumeDeltaPlus[index])) * 100).ToString("F0"), index, Bars.LowPrices[index] - 5 * Symbol.PipSize, Color.Red);
}
if (!isLastB)
prevBars = Bars.OpenTimes.Last(0);
double test = index / barsCount * 100;
if (pct < test + 0.1 && pct < 105)
{
Print("Load : " + test.ToString("F0") + " %");
pct += 10;
}
}
}
}
YesOrNot2
Joined on 17.05.2024
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Volume Pulse v2.1 .algo
- Rating: 5
- Installs: 665
- Modified: 17/05/2024 12:35
Comments
Your conclusions are probably not accurate. This may be why someone was bitterly jealous of your good work in producing accurate indicator readings. I was unable to install your Volume Pulse V.2.1 indicator in my CTrader, I received a message that you are blocked. This is probably all unfortunate, I'm wasting my time working in CTrader. I do not exclude that for clarification you need to contact the support service of the administration of this site SPOWARE CTRADER. Sincerely. I wish you a speedy exit from self-isolation. And I apologize for the inaccurate translation. I also express my gratitude to you for your work in creating indicators.
whoever got you blocked is obviously a complete w*nker as everything you've given is given generously and for free.
welcome back!!
Thank you for the support!
sherlock828r If needed, I am available on Telegram. =)