Is there a bug in the value of bottomY?

Created at 23 Dec 2021, 12:17
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!
yomm0401's avatar

yomm0401

Joined 11.04.2020

Is there a bug in the value of bottomY?
23 Dec 2021, 12:17


Hi, I am creating an indicator using the TopY and bottomY values.

Sometimes when I draw a trendline based on these values, the line using the bottomY value does not show up.

When I use the TopY value, it is displayed correctly, so I think there is a bug in the bottomY value.
Or am I writing the code wrong?
Please help me.

 


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


namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TopYbottomYtest : Indicator
    {
        private double topY, bottomY;
        protected override void Initialize()
        {
            TopBottomYtest();
            Chart.ScrollChanged += onscrollchanged;
        }

        private void onscrollchanged(ChartScrollEventArgs f)
        {
            TopBottomYtest();
        }

        private void TopBottomYtest()
        {
            topY = Math.Round(Chart.TopY, Symbol.Digits);
            bottomY = Math.Round(Chart.BottomY, Symbol.Digits);
            Chart.DrawStaticText("test", "TOP " + topY.ToString() + " Bottom " + bottomY.ToString(), VerticalAlignment.Bottom, HorizontalAlignment.Center, Color.Red);
            Chart.DrawTrendLine("trendlinetesttop", Chart.LastVisibleBarIndex, Chart.TopY, Chart.LastVisibleBarIndex + 5, Chart.TopY, Color.Red, 30);
            Chart.DrawTrendLine("trendlinetestbottom", Chart.LastVisibleBarIndex, Chart.BottomY, Chart.LastVisibleBarIndex + 5, Chart.BottomY, Color.Red, 30);

        }
        public override void Calculate(int index)
        {
        }


    }
}


@yomm0401
Replies

amusleh
24 Dec 2021, 07:57

Hi,

It works fine, try this:

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TopYbottomYtest : Indicator
    {
        private double topY, bottomY;

        protected override void Initialize()
        {
            TopBottomYtest();
            Chart.ScrollChanged += onscrollchanged;
        }

        private void onscrollchanged(ChartScrollEventArgs f)
        {
            TopBottomYtest();
        }

        private void TopBottomYtest()
        {
            topY = Math.Round(Chart.TopY, Symbol.Digits);
            bottomY = Math.Round(Chart.BottomY, Symbol.Digits);
            Chart.DrawStaticText("test", "TOP " + topY.ToString() + " Bottom " + bottomY.ToString(), VerticalAlignment.Bottom, HorizontalAlignment.Center, Color.Red);
            Chart.DrawTrendLine("trendlinetesttop", Chart.FirstVisibleBarIndex, Chart.TopY, Chart.LastVisibleBarIndex, Chart.TopY, Color.Red, 30);
            Chart.DrawTrendLine("trendlinetestbottom", Chart.FirstVisibleBarIndex, Chart.BottomY, Chart.LastVisibleBarIndex, Chart.BottomY, Color.Red, 30);
        }

        public override void Calculate(int index)
        {
        }
    }
}

 


@amusleh

yomm0401
24 Dec 2021, 09:13

RE:

amusleh said:

Hi,

It works fine, try this:

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TopYbottomYtest : Indicator
    {
        private double topY, bottomY;

        protected override void Initialize()
        {
            TopBottomYtest();
            Chart.ScrollChanged += onscrollchanged;
        }

        private void onscrollchanged(ChartScrollEventArgs f)
        {
            TopBottomYtest();
        }

        private void TopBottomYtest()
        {
            topY = Math.Round(Chart.TopY, Symbol.Digits);
            bottomY = Math.Round(Chart.BottomY, Symbol.Digits);
            Chart.DrawStaticText("test", "TOP " + topY.ToString() + " Bottom " + bottomY.ToString(), VerticalAlignment.Bottom, HorizontalAlignment.Center, Color.Red);
            Chart.DrawTrendLine("trendlinetesttop", Chart.FirstVisibleBarIndex, Chart.TopY, Chart.LastVisibleBarIndex, Chart.TopY, Color.Red, 30);
            Chart.DrawTrendLine("trendlinetestbottom", Chart.FirstVisibleBarIndex, Chart.BottomY, Chart.LastVisibleBarIndex, Chart.BottomY, Color.Red, 30);
        }

        public override void Calculate(int index)
        {
        }
    }
}

 

Thanks for the reply.

I have confirmed that the BottomY trendline does not disappear with your code.
However, the problem is that it does not show up when I specify it using a number from "LastVisibleBarIndex".
I don't want to show the trendline on all the bottoms of the chart.

I want to show the trendline on all the bottoms of the chart using a number from "LastVisibleBarIndex".

I want to show the trendline on plus or minus several bars from the "LastVisibleBarIndex".
In this sense, I think it is a bug in cTrader.

 

 


@yomm0401

amusleh
24 Dec 2021, 11:24

Hi,

I tired with your exact code and its working fine, I replicated your actions on the video and the bottom line didn't disappeared.

Can you tell me which broker cTrader you are using or which version? I tried on Spotware Beta cTrader 4.1.


@amusleh

yomm0401
24 Dec 2021, 12:02

RE:

amusleh said:

Hi,

I tired with your exact code and its working fine, I replicated your actions on the video and the bottom line didn't disappeared.

Can you tell me which broker cTrader you are using or which version? I tried on Spotware Beta cTrader 4.1.

I have also tested it with PulicBeta4.1 of SportWare cTrader, but it does not solve the problem of not showing up.
It looks like the video.

I thought it might be a memory issue, so I restarted the computer and checked with only one cTrader open.
Also, the specs of my computer is a desktop computer, Corei 7-7700K memory 16GB, so I don't think it's a problem.


@yomm0401

amusleh
27 Dec 2021, 09:00

Hi,

As I said it works fine on my system:

Can you tell what's you system graphics card? most probably that's the issue as it can't process fast enough that amount of data.


@amusleh

yomm0401
27 Dec 2021, 10:19

RE:

amusleh said:

Hi,

As I said it works fine on my system:

Can you tell what's you system graphics card? most probably that's the issue as it can't process fast enough that amount of data.

That's the most likely scenario.
However, when I tried it on a laptop without a high performance graphics card, it displayed correctly.
So that means the problem is with my graphics card.
Thank you for taking care of this for me at the busy end of the year.

Have a happy new year


@yomm0401

notoriousocean
21 May 2022, 07:27

Display Date Pro issue

Hey there!

 

I bought your display date pro, and installed it. It only displays the date and time but not the vertical lines as shown in the video. how can i get it to show the lines? 


@notoriousocean

amusleh
23 May 2022, 08:57 ( Updated at: 23 May 2022, 08:58 )

RE: Display Date Pro issue

notoriousocean said:

Hey there!

 

I bought your display date pro, and installed it. It only displays the date and time but not the vertical lines as shown in the video. how can i get it to show the lines? 

Hi,

Not sure what you are talking about, please contact the company you bought the product from.

And don't post on threads that aren't related to your issue.


@amusleh