Login Page - Create Account

Support Board


Date/Time: Sat, 15 Mar 2025 15:38:05 +0000



Post From: Update previous drawing in study when doing AutoLooping

[2022-07-12 18:58:02]
JohnR - User831573 - Posts: 320
FYI - I am not a great coder, like some here, but this is how I would approach your task.

JohnR

During real time vs historical updates, you would have to determine if you want to update your zones on each tick, or wait until (EOB) end of bar/ new bar first calc. If you are processing once per bar, then the following is one idea.

somewhere within your study definition

  int& lastIndex = sc.GetPersistentInt(1);

Then on first bar, set your var LastIndex

  if (sc.Index == 0)
  {
    lastIndex = -1;

then within the Data Processing (bar/tick update section)

  if (sc.Index != lastIndex) // this is true when there is a new bar
  {
    lastIndex = sc.Index;
    
Add your logic here to modify existing / create new zones
  }