Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 21:54:51 +0000



CustomChart is incompatible with GDI function call

View Count: 754

[2022-01-11 21:33:08]
ejtrader - Posts: 688
SC Team - When the custom chart is used unable to use any GDI calls from that custom study chart.

Rather than marking as programming help - could you please test it internally and confirm? Do have a requirement to draw GDI objects from Customchart itself and appreciate if there is a fix for this.
Thanks


sc.fp_ACSCustomChartBarFunction = CustomChartBarBuildingFunction; --- this line works fine and builds the custom chart
sc.p_GDIFunction = DrawToChart_1; --> call to this GDI function is not working when used in the same code as customstudy code. However when inserted as a seperate study on this chart based on the customchart study - it works fine.

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphRegion = 0;
    sc.GraphName = "Custom Chart Bars Example";
    sc.UsesCustomChartBarFunction = 1;

    // This function is called from another thread.
    sc.fp_ACSCustomChartBarFunction = CustomChartBarBuildingFunction;

sc.p_GDIFunction = DrawToChart_1; // This line doesn't work when used in Custom Chart Bars code. But when a seperate study is built using this function it works fine

    sc.AutoLoop = 0;//Always use manual looping.

    //sc.MaintainAdditionalChartDataArrays = 1;
    //sc.AllocateAndNameRenkoChartBarArrays = 1;

    Input_VolumePerBar.Name = "Volume Per Bar";
    Input_VolumePerBar.SetInt(1000);
    Input_VolumePerBar.SetIntLimits(1, INT_MAX);

    return;
  }

Date Time Of Last Edit: 2022-01-12 02:19:01
[2022-01-16 18:32:36]
ejtrader - Posts: 688
SC Team - Any comment on this? Please don't mark it as programming help. If you are not going to fix this - you can say so.

Thanks
Date Time Of Last Edit: 2022-01-16 18:32:55
[2022-01-29 14:11:15]
ejtrader - Posts: 688
SC Team - Any comment on this?
[2022-06-18 03:29:43]
ejtrader - Posts: 688
SC Team - Is this supposed to work or not? So far all the attempts to use these 2 functions together in the same code didn't work.

Thanks
[2022-06-18 09:32:17]
User431178 - Posts: 417
Not SC team, but...

When a instance of the study is added to the chart the Hide Study setting is automatically enabled. It is not possible to disable this.

ACSIL Interface - Custom Chart Bars: Introduction

As the chart building study is always hidden automatically, it would be a pretty safe bet to assume that the custom drawing function would not be called (as would be the case with any other study).

You can confirm this yourself if you have another study the that uses a custom drawing function. Attach a debugger, hide the study, then check to see if the chart drawing function is called (it isn't).
Date Time Of Last Edit: 2022-06-18 09:33:09
[2022-06-18 14:52:21]
ejtrader - Posts: 688
User431178 - Thanks. When second study which is custom chart drawing does work with custom chart bars. The issue is mainly if the customchart function and gdi function are used in the same study.
[2022-06-18 16:35:53]
User431178 - Posts: 417
Yes, exactly, as the custom chart study is always automatically hidden, the gdi function in the same study would never be called.
So, as you've found, the solution is a separate study.
[2022-06-18 16:57:27]
ejtrader - Posts: 688
User431178 - Thanks. If this is a design limitation I accept and move on but my requirement is to use custom GDI call from custom chart function to avoid repeating the logic one more time in GDI function call.

I have the old way of building custom bars where I could also use GDI call within the same code. Just trying to convert to the new way of building custom chart but unable to call GDI call from the same study.

SC Team - any input on this? Is there any technical limitation on this?

Thanks

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account