Angle of the trendline
Angle of the trendline
10 Feb 2021, 18:53
Hi Support
I have a test cbot and I'm looking how to assign trend angle into variable, but I can see any property to do that.
Can you please let me know if it possible to assign a trend angle into variable?
If not, can you please advice how trend angle is calculated so I can create a method myself?
Please see my code below
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 NewIndicator : Indicator
{
[Parameter(DefaultValue = 0.0)]
public double Parameter { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
double myangle;
protected override void Initialize()
{
// Initialize and create nested indicators
}
public override void Calculate(int index)
{
ChartTrendLine tl = Chart.DrawTrendLine("trendline", Bars.OpenTimes.Last(10), Bars.OpenPrices.Last(10), Bars.OpenTimes.Last(1), Bars.OpenPrices.Last(1), Color.White);
tl.ShowAngle;
}
}
}
PanagiotisCharalampous
11 Feb 2021, 08:23
Hi malas7malas,
There is no such property at the moment. The angle calculation is based on the screen pixels which are also not accessible at the moment.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous