Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 00:35:12 +0000



Post From: Plots into the forward space disappear when new bar starts

[2023-06-22 17:18:27]
User431178 - Posts: 544
As you've found, extended array elements are cleared when new bars are added.
Instead of using GetBarHasClosedStatus(), try uisng a persistent int variable to store the last index processed.
This way you can perform the calculation once, on the new bar when it is added.


int& lastProcessed = sc.GetPersistentInt(0);

for (int i = sc.UpdateStartIndex; i < sc.ArraySize; ++i)
{
/// some code ///

if (i > lastProcessed)
{
lastProcessed = i;

// some code to update the extended array elements
}

/// some other code ///

}


Date Time Of Last Edit: 2023-06-22 17:18:37