Angle of the trendline

Created at 10 Feb 2021, 18:53
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MA

malas7malas

Joined 08.12.2019

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;

        }
    }
}

 

 

 

 


@malas7malas
Replies

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

mikefox
01 Dec 2023, 18:47 ( Updated at: 02 Dec 2023, 07:19 )

Iam looking for the same thing and going trough plattforms. 

One of the reasons iam looking at python solutions. 

Python could do that. 


@mikefox