Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 00:55:07 +0000



Post From: Access data using GDIFunction DrawToChart()

[2024-01-21 16:22:22]
User431178 - Posts: 541

if (currentBar < newYorkStart || currentBar > newYorkEnd)
return;

The above code should be below the LastCallToFunction block, and probably below the block where you allocate the new map.
Why?
What happens if you remove the study outside of NY hours? You would never clean up the memory that you allocated.
What happens when you recalculate the chart? You may well delete the map and not reallocate it, but the DrawToChart function is still being called, maybe with an invalid pointer being used.

You could set the below when you recalculate the chart.
sc.p_GDIFunction = nullptr
That would prevent the DrawToChart function being called until you do actually reallocate the map.

And what about the code that you use for drawing? Do you check that the persistent pointer is valid?
Date Time Of Last Edit: 2024-01-21 16:22:58