URGENT HELP

Created at 21 Jul 2018, 11:30
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!
JO

johnreygalax8

Joined 21.07.2018

URGENT HELP
21 Jul 2018, 11:30


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using cAlgo.API;
 
namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class RoundNumbers : Indicator
    {
        [Parameter(DefaultValue = 100)]
        public int StepPips { get; set; }
 
        protected override void Initialize()
        {
            double max = MarketSeries.High.Maximum(MarketSeries.High.Count);
            double min = MarketSeries.Low.Minimum(MarketSeries.Low.Count);
 
            double step = Symbol.PipSize*StepPips;
            double start = Math.Floor(min/step)*step;
 
            for (double level = start; level <= max + step; level += step)
            {
                ChartObjects.DrawHorizontalLine("line_" + level, level, Colors.Gray);
            }
        }
 
        public override void Calculate(int index)
        {
        }
    }
}

Is there any way to HIGHLIGT the price level that corresponds to the line???

 

 

example like the image attached


@johnreygalax8
Replies

PanagiotisCharalampous
23 Jul 2018, 09:39

Hi johnreygalax8,

Unfortunately this is currently not possible. You could consider a workaround by printing labels on top of the lines.

Best Regards,

Panagiotis


@PanagiotisCharalampous

johnreygalax8
23 Jul 2018, 17:53

can you help me how to do that. im sorry i dont know anything about programming thanks


@johnreygalax8

PanagiotisCharalampous
24 Jul 2018, 09:14

Hi johnreygalax8,

See an example below

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class RoundNumbers : Indicator
    {
        [Parameter(DefaultValue = 100)]
        public int StepPips { get; set; }

        protected override void Initialize()
        {

        }

        public override void Calculate(int index)
        {
            ChartObjects.RemoveAllObjects();
            double max = MarketSeries.High.Maximum(MarketSeries.High.Count);
            double min = MarketSeries.Low.Minimum(MarketSeries.Low.Count);

            double step = Symbol.PipSize * StepPips;
            double start = Math.Floor(min / step) * step;

            for (double level = start; level <= max + step; level += step)
            {
                ChartObjects.DrawText("text_" + level, level.ToString(), index, level);
                ChartObjects.DrawHorizontalLine("line_" + level, level, Colors.Gray);
            }
        }
    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous