Information
Username: | JS15 |
Member since: | 15 Jan 2015 |
Last login: | 13 Sep 2024 |
Status: | Active |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 0 | 9 |
Forum Topics | 8 | 8 |
Jobs | 1 | 0 |
Last Algorithm Comments
Hi looks cool. How do I use it? What do I look for?
Thanks
Hi there, a generous person on the cTrader Telegram who goes by the name /DarthMaulAtWork/ showed me what to do. Thanks again!
I copied and pasted the code below. It only highlights the 1sd but if you add:
[Cloud("Upper Deviation 2", "Lower Deviation 2")]
and/or
[Cloud("Upper Deviation 3", "Lower Deviation 3")]
below [Cloud("Upper Deviation 1", "Lower Deviation 1")]
you can shade the 2nd and 3rd Std Deviation bands too.
Thank you for the coding of this indicator, it is amazing!!!
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Cloud("Upper Deviation 1", "Lower Deviation 1")]
[Indicator(IsOverlay = true, AutoRescale = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class VWAPCloud : Indicator
{
[Parameter("TimeFrame")]
public TimeFrame TF { get; set; }
[Parameter("Show Interruptions", DefaultValue = false)]
public bool ShowInterruptions { get; set; }
[Parameter("Show Standard Deviations", Group = "Standard Deviations", DefaultValue = false)]
public bool ShowSTDs { get; set; }
[Parameter("First Multiplier", Group = "Standard Deviations", DefaultValue = 1)]
public double STD1M { get; set; }
[Parameter("Second Multiplier", Group = "Standard Deviations", DefaultValue = 2)]
public double STD2M { get; set; }
[Parameter("Third Multiplier", Group = "Standard Deviations", DefaultValue = 3)]
public double STD3M { get; set; }
[Output("Main", Color = Colors.Orange, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries Result { get; set; }
[Output("Upper Deviation 1", Color = Colors.RoyalBlue, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries STD1U { get; set; }
[Output("Lower Deviation 1", Color = Colors.RoyalBlue, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries STD1D { get; set; }
[Output("Upper Deviation 2", Color = Colors.RoyalBlue, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries STD2U { get; set; }
[Output("Lower Deviation 2", Color = Colors.RoyalBlue, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries STD2D { get; set; }
[Output("Upper Deviation 3", Color = Colors.RoyalBlue, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries STD3U { get; set; }
[Output("Lower Deviation 3", Color = Colors.RoyalBlue, Thickness = 2, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries STD3D { get; set; }
[Parameter("Build Lines", Group = "Lines", DefaultValue = false)]
public bool BuilLines { get; set; }
public IndicatorDataSeries tpv;
private MarketSeries Series;
private int LastStartIndex = 0;
protected override void Initialize()
{
Series = MarketData.GetSeries(TF);
tpv = CreateDataSeries();
}
public override void Calculate(int index)
{
tpv[index] = MarketSeries.Close[index] * MarketSeries.TickVolume[index];
int startIndex = MarketSeries.OpenTime.GetIndexByTime(Series.OpenTime[Series.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index])]);
if (startIndex > LastStartIndex)
{
if (ShowInterruptions)
Chart.DrawIcon("Interruption " + startIndex, ChartIconType.Diamond, startIndex, Result[startIndex - 1], Color.Yellow);
}
double cptv = 0, cv = 0;
for (int i = index; i >= startIndex; --i)
{
cptv += tpv[i];
cv += MarketSeries.TickVolume[i];
}
Result[index] = cptv / cv;
//Standard deviation
if (ShowSTDs)
{
double squaredErrors = 0;
for (int i = index; i >= startIndex; --i)
{
squaredErrors += Math.Pow(MarketSeries.Close[i] - Result[index], 2);
}
squaredErrors /= (index - startIndex + 1);
squaredErrors = Math.Sqrt(squaredErrors);
STD1U[index] = squaredErrors * STD1M + Result[index];
STD1D[index] = Result[index] - squaredErrors * STD1M;
STD2U[index] = squaredErrors * STD2M + Result[index];
STD2D[index] = Result[index] - squaredErrors * STD2M;
STD3U[index] = squaredErrors * STD3M + Result[index];
STD3D[index] = Result[index] - squaredErrors * STD3M;
}
//Build lines
if (BuilLines)
Chart.DrawTrendLine("Fixed " + startIndex, startIndex, Result[startIndex - 1], index, Result[startIndex - 1], Color.Yellow);
}
}
}
Hi there,
Thank you for this awesome indicator!
Ctrader now enables you to draw semi-transparent clouds between two indicator lines. I was wondering if you could draw a cloud between the Upper and Lower 1SD VWAP Bands if possible.
Happy to pay for this to be done.
Please let me know.
Love your work.
Thank you
JS
Awesome indicator! Is there any way to convert it to Sierra Chart?
Thanks
Hi Awesome indicator.
How did you write the color shading between the two lines in C Algo.
I wanted to do that with Bollinger Bands ie. Color shade between the upper and lower bands.
Cheers
Hi, thanks for the indicator. Would you know how to shade the area between the upper and lower bands?
I saw the Ichimoku Cloud has shading and and tried to see how it was done but could not find it. Here is the example /algos/indicators/show/381.
Cheers
Hi,
This indicator is amazing. Would you by and chance have the cAlgo code for a Regression line also known as Linear Regression Forecast. Cheers JS
Hi I love this version of the spread. I'm so terrible with code. How would I change this code to show a decimal. Thanks