Warning! This section will be deprecated on February 1st 2025. Please move all your Indicators to the cTrader Store catalogue.
Description
THIS INDICATOR TELLS YOU WHEN VOLATILITY BEGINS AND ENDS DIRECTLY IN THE CANDLES
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ChaikinVolatilityWithCandles : Indicator
{
private TextBlock tb = new TextBlock();
private ChaikinVolatility chaikinVolatility;
// Parameters
[Parameter("Font Size", DefaultValue = 12)]
public int FontSize { get; set; }
[Parameter("Space to Corner", DefaultValue = 12)]
public int Margin { get; set; }
[Parameter("Horizontal Alignment", DefaultValue = HorizontalAlignment.Left)]
public HorizontalAlignment HAlignment { get; set; }
[Parameter("Vertical Alignment", DefaultValue = VerticalAlignment.Top)]
public VerticalAlignment VAlignment { get; set; }
[Parameter("Color", DefaultValue = "Black")]
public Color Color1 { get; set; }
[Parameter("Bull Market Color", DefaultValue = "Orange")]
public string BullMarketColor { get; set; }
[Parameter("Bear Market Color", DefaultValue = "Orange")]
public string BearMarketColor { get; set; }
[Parameter("Neutral Color", DefaultValue = "Black")]
public string NeutralColor { get; set; }
private Color bullMarketColor;
private Color bearMarketColor;
private Color neutralColor;
protected override void Initialize()
{
// Initialize ChaikinVolatility indicator
chaikinVolatility = Indicators.ChaikinVolatility(10, 10, MovingAverageType.Exponential);
// Add TextBlock to the chart
Chart.AddControl(tb);
bullMarketColor = Color.FromName(BullMarketColor);
bearMarketColor = Color.FromName(BearMarketColor);
neutralColor = Color.FromName(NeutralColor);
}
public override void Calculate(int index)
{
double chaikinVolatilityValue = chaikinVolatility.Result[index];
// Logica per individuare le giornate laterali
if (chaikinVolatilityValue < 0)
Chart.SetBarColor(index, neutralColor);
else if (MarketSeries.Close[index] > MarketSeries.Open[index])
Chart.SetBarColor(index, bullMarketColor);
else
Chart.SetBarColor(index, bearMarketColor);
// Display Result of Chaikin Volatility
string chaikinVolatilityText = " " + chaikinVolatilityValue.ToString("F2");
// Set TextBlock properties
tb.Text = chaikinVolatilityText;
tb.FontSize = FontSize;
// Color Chaikin Volatility text based on conditions
tb.ForegroundColor = chaikinVolatilityValue > 0 ? Color.FromName("BLUE") : Color1;
// Set the position of the text using specific parameters
tb.HorizontalAlignment = HAlignment;
tb.VerticalAlignment = VAlignment;
tb.Margin = Margin;
}
}
}
DE
DELETED_USER
Joined on 28.06.2022 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: cvcandela.algo
- Rating: 0
- Installs: 273
- Modified: 18/12/2023 17:21
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.