Replies

tuuguu177
23 May 2024, 11:38 ( Updated at: 23 May 2024, 12:59 )

RE: RE: RE: RE: RE: How to create dynamic horizontal line

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

Hi there,

You can use DrawHorizontalLine to draw horizontal lines.

Best regards,

Panagiotis

but how to make it dynamic. Dynamic means Horizontal lines follow price.

Hi there, 

Just draw the line at the specific price you want on each tick. If you use the same name for your line it will replace the previous one, making it dynamic.

Best regards,

Panagiotis

Could you please show me the code? Sorry i am super newbie at coding. Thank you very much

There is example code in the documentation. Try doing this yourself and let us know where you have questions and what is blocking you to move further.

could you pls share example code documentation for making dynamic horizontal line?


@tuuguu177

tuuguu177
23 May 2024, 09:56 ( Updated at: 23 May 2024, 11:04 )

RE: RE: RE: RE: RE: How to create dynamic horizontal line

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

Hi there,

You can use DrawHorizontalLine to draw horizontal lines.

Best regards,

Panagiotis

but how to make it dynamic. Dynamic means Horizontal lines follow price.

Hi there, 

Just draw the line at the specific price you want on each tick. If you use the same name for your line it will replace the previous one, making it dynamic.

Best regards,

Panagiotis

Could you please show me the code? Sorry i am super newbie at coding. Thank you very much

There is example code in the documentation. Try doing this yourself and let us know where you have questions and what is blocking you to move further.

okey. I tried and created static horizontal line. This is code i write. Now I can not understand how to make it dynamic. Could you please advise?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.None)]
    public class dynamic_HLine : Indicator
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate
            Chart.DrawHorizontalLine("horizontalLine", 2362, Color.Red);
            //Print(Message);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }
    }
}


@tuuguu177

tuuguu177
23 May 2024, 09:34 ( Updated at: 23 May 2024, 09:42 )

RE: RE: RE: How to create dynamic horizontal line

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

Hi there,

You can use DrawHorizontalLine to draw horizontal lines.

Best regards,

Panagiotis

but how to make it dynamic. Dynamic means Horizontal lines follow price.

Hi there, 

Just draw the line at the specific price you want on each tick. If you use the same name for your line it will replace the previous one, making it dynamic.

Best regards,

Panagiotis

Could you please show me the code? Sorry i am super newbie at coding. Thank you very much


@tuuguu177

tuuguu177
23 May 2024, 07:21 ( Updated at: 23 May 2024, 08:29 )

RE: How to create dynamic horizontal line

PanagiotisCharalampous said: 

Hi there,

You can use DrawHorizontalLine to draw horizontal lines.

Best regards,

Panagiotis

but how to make it dynamic. Dynamic means Horizontal lines follow price.


@tuuguu177