Description
- The Value Chart was developed to show the valuation of the market.
- The Value Chart could be described as a DeTrended Oscillator in which the higher or lower the value on the Value Chart the more likely it is to reverse direction.
Updates:
- 19/03/2016 - Released.
Parameters:
- Period - Period used for calculations.
- MA Type - Moving Average Type used for calculations.
- Body Width - Body thickness for candlesticks.
- Default Colors - Switches from default colors to OB/OS highlight colors.
- Overbought / Oversold Levels - Defines OB/OS areas.
Screenshots:
Make a Donation
- If you like my work and effort then please consider to make a kind donation thru PayPal or any Credit Card at the top right corner.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Levels(0)]
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ValueChart : Indicator
{
[Parameter("Period", DefaultValue = 5)]
public int Period { get; set; }
[Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
public MovingAverageType MAType { get; set; }
[Parameter("Body Width", DefaultValue = 3)]
public int BodyWidth { get; set; }
[Parameter("Default Colors", DefaultValue = true)]
public bool DefaultColors { get; set; }
[Parameter("Overbought Level", DefaultValue = 10)]
public double OverboughtLevel { get; set; }
[Parameter("Oversold Level", DefaultValue = -10)]
public double OversoldLevel { get; set; }
[Output("Open", Color = Colors.Black, PlotType = PlotType.Points)]
public IndicatorDataSeries Open { get; set; }
[Output("High", Color = Colors.Black, PlotType = PlotType.Points)]
public IndicatorDataSeries High { get; set; }
[Output("Low", Color = Colors.Black, PlotType = PlotType.Points)]
public IndicatorDataSeries Low { get; set; }
[Output("Close", Color = Colors.Black, PlotType = PlotType.Points)]
public IndicatorDataSeries Close { get; set; }
private IndicatorDataSeries middleSource, scaleSource;
private MovingAverage middleMA, scaleMA;
protected override void Initialize()
{
middleSource = CreateDataSeries();
scaleSource = CreateDataSeries();
middleMA = Indicators.MovingAverage(middleSource, Period, MAType);
scaleMA = Indicators.MovingAverage(scaleSource, Period, MAType);
}
public override void Calculate(int index)
{
middleSource[index] = (MarketSeries.High[index] + MarketSeries.Low[index]) / 2;
scaleSource[index] = MarketSeries.High[index] - MarketSeries.Low[index];
double middle = middleMA.Result[index];
double scale = scaleMA.Result[index] * 0.2;
Open[index] = (MarketSeries.Open[index] - middle) / scale;
High[index] = (MarketSeries.High[index] - middle) / scale;
Low[index] = (MarketSeries.Low[index] - middle) / scale;
Close[index] = (MarketSeries.Close[index] - middle) / scale;
var colorWick = MarketSeries.Open[index] < MarketSeries.Close[index] ? Colors.DarkGreen : Colors.DarkRed;
var colorBody = MarketSeries.Open[index] < MarketSeries.Close[index] ? Colors.Lime : Colors.Red;
ChartObjects.DrawLine("wick" + index, index, High[index], index, Low[index], DefaultColors ? colorWick : Colors.Gray);
ChartObjects.DrawLine("body" + index, index, Open[index], index, Close[index], DefaultColors ? colorBody : Colors.Gray, BodyWidth);
ChartObjects.DrawHorizontalLine("ob level", OverboughtLevel, Colors.DimGray);
ChartObjects.DrawHorizontalLine("os level", OversoldLevel, Colors.DimGray);
if (!DefaultColors)
{
if (High[index] > OverboughtLevel)
ChartObjects.DrawLine("ob wick" + index, index, High[index], index, OverboughtLevel, Colors.DarkGreen);
if (Math.Max(Open[index], Close[index]) > OverboughtLevel)
ChartObjects.DrawLine("ob body" + index, index, Math.Max(Open[index], Close[index]), index, OverboughtLevel, Colors.Lime, BodyWidth);
if (Low[index] < OversoldLevel)
ChartObjects.DrawLine("os wick" + index, index, Low[index], index, OversoldLevel, Colors.DarkRed);
if (Math.Min(Open[index], Close[index]) < OversoldLevel)
ChartObjects.DrawLine("os body" + index, index, Math.Min(Open[index], Close[index]), index, OversoldLevel, Colors.Red, BodyWidth);
}
}
}
}
whis.gg
Joined on 31.08.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: .ValueChart.algo
- Rating: 4.17
- Installs: 2988
- Modified: 13/10/2021 09:55
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.
PR
Dear tmc, can you make the dynamic version of value chart?
this is a nice piece of work .. i just noticed that there is also a very clear divergence relation between the indicator and the real price ... that could be a nice edge to develop on
Great indicator
If you can add divergences and email alert to it would be nice thing