Drawtext at bottom of screen

Created at 13 Apr 2020, 11:09
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!
NG

nguyendan81985

Joined 24.10.2018

Drawtext at bottom of screen
13 Apr 2020, 11:09


hi Pangiotis,

i want to make a text to bottom of screen, can you help me? my code is below:

 

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

namespace cAlgo
{

    [Indicator("test", IsOverlay = true, AccessRights = AccessRights.None)]
    public class test : Indicator
    {


        protected override void Initialize()
        {


        }

        public override void Calculate(int index)
        {


            Chart.DrawVerticalLine("line 9", index - 8, Color.Gray, 1, LineStyle.LinesDots);
            Chart.DrawVerticalLine("line 17", index - 16, Color.Gray, 1, LineStyle.LinesDots);

            Chart.DrawText("9", "9", index - 8, MarketSeries.High[index], Color.White);
            Chart.DrawText("17", "17", index - 16, MarketSeries.High[index], Color.White);


        }

    }
}




 

 


@nguyendan81985
Replies

PanagiotisCharalampous
13 Apr 2020, 11:44

Hi there,

Check the example below

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

namespace cAlgo
{

    [Indicator("test", IsOverlay = true, AccessRights = AccessRights.None)]
    public class test : Indicator
    {
        [Parameter("Offset (Pips)", DefaultValue = 5)]
        public int Offset { get; set; }

        protected override void Initialize()
        {


        }

        public override void Calculate(int index)
        {


            Chart.DrawVerticalLine("line 9", index - 8, Color.Gray, 1, LineStyle.LinesDots);
            Chart.DrawVerticalLine("line 17", index - 16, Color.Gray, 1, LineStyle.LinesDots);

            Chart.DrawText("9", "9", index - 8, Chart.BottomY + (Symbol.PipSize * Offset), Color.White);
            Chart.DrawText("17", "17", index - 16, Chart.BottomY + (Symbol.PipSize * Offset), Color.White);


        }

    }
}

 

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous