Login Page - Create Account

Support Board


Date/Time: Wed, 08 May 2024 22:23:53 +0000



Post From: Using AddLineUntilFutureIntersectionEx after a full recalculation

[2021-07-19 19:07:09]
@sstfrederik - Posts: 403
Hi,

I have an issue with the function: AddLineUntilFutureIntersectionEx.

When I use it to plot a line until intercept on some previous bar after a full recalulation the line plots all the way and is not plotted until intercept from the set StartBarIndex.

I would like to use this function on data I only have available some time after the study is fully recalculated.

Can this be resolved?

Thank you

Frederik

See below code example:


#include "sierrachart.h"
SCDLLName("SomeTestingStudy")

SCSFExport scsf_TestStudy(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    
    sc.GraphName = "Test Intercept";
    
    sc.StudyDescription = "test";
    
    sc.AutoLoop = 0;
    
    sc.GraphRegion = 0;
    
    return;
  }
  
  
  int& Testplot = sc.GetPersistentInt(0);
  
  if(sc.UpdateStartIndex == 0){
    
    Testplot = 0;
  }
  
  //Do data processing
  
  
  //comment 2 lines below to see plotting working
  if(sc.IsFullRecalculation)
    return;
  
  //we only plot after a full recalulation has happened ... not working
  
  for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; BarIndex++){
  
    
    int IndexToPlot = 3248; //some index number; choose any //used a 30 days 5 min ES chart for testing
    
    if(Testplot == 0){
      n_ACSIL::s_LineUntilFutureIntersection LineUntilFutureIntersection;
      LineUntilFutureIntersection.StartBarIndex = IndexToPlot;
      LineUntilFutureIntersection.EndBarIndex = 0;
      LineUntilFutureIntersection.LineIDForBar = 0;
      LineUntilFutureIntersection.LineValue = 4333.75; //some test value
      LineUntilFutureIntersection.LineColor = RGB(0,0,255);
      LineUntilFutureIntersection.LineWidth = 2;
      LineUntilFutureIntersection.LineStyle = LINESTYLE_SOLID;
      LineUntilFutureIntersection.PerformCloseCrossoverComparison = 0;
      LineUntilFutureIntersection.AlwaysExtendToEndOfChart = 0;
      sc.AddLineUntilFutureIntersectionEx(LineUntilFutureIntersection);
      Testplot = 1;
    }
  }      
}

Date Time Of Last Edit: 2021-07-19 19:18:44