Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 10:16:10 +0000



Post From: Can I plot data from file into the future on a chart?

[2014-01-14 07:16:25]
Sierra Chart Engineering - Posts: 104368
Here is an example of drawing bars into the forward projection area:

http://www.sierrachart.com/image.php?l=1389683535406.png



SCSFExport scsf_ForwardProjectionBars(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Open = sc.Subgraph[0];
  SCSubgraphRef High = sc.Subgraph[1];
  SCSubgraphRef Low = sc.Subgraph[2];
  SCSubgraphRef Last = sc.Subgraph[3];


  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.FreeDLL = 0;

    sc.GraphName = "Forward Projection Bars";

    sc.AutoLoop = 1;
    sc.GraphRegion = 1;
    sc.GraphDrawType=GDT_OHLCBAR;

    Open.Name = "Open";
    Open.DrawStyle = DRAWSTYLE_LINE;
    Open.PrimaryColor = RGB(0,255,0);
    Open.DrawZeros = false;
     Open.ExtendedArrayElementsToGraph= 100;

    High.Name = "High";
    High.DrawStyle = DRAWSTYLE_LINE;
    High.PrimaryColor = RGB(0,255,0);
    High.DrawZeros = false;
    High.ExtendedArrayElementsToGraph= 100;

    Low.Name = "Low";
    Low.DrawStyle = DRAWSTYLE_LINE;
    Low.PrimaryColor = RGB(0,255,0);
    Low.DrawZeros = false;
    Low.ExtendedArrayElementsToGraph= 100;

    Last.Name = "Last";
    Last.DrawStyle = DRAWSTYLE_LINE;
    Last.PrimaryColor = RGB(0,255,0);
    Last.DrawZeros = false;
    Last.ExtendedArrayElementsToGraph= 100;


    return;
  }

  // Do data processing

  //Repeat last bar into forward projection area.
  if(sc.Index+1 >= sc.ArraySize)  
  {
    for (int Index = sc.ArraySize ; Index < sc.ArraySize + Open.ExtendedArrayElementsToGraph ; Index++)
    {  
      Open[Index] = sc.Open[sc.Index];
      High[Index] = sc. High[sc.Index];
      Low[Index] = sc. Low[sc.Index];
      Last[Index] = sc. Close[sc.Index];
    }
  }

  return;
}


The below code makes no consideration to the indexes to use for PriceArray [] that correspond with ForecastOverlay []. You will need to work out these details. We recommend looking at this page:
http://www.sierrachart.com/index.php?l=doc/doc_ACSILRefOtherTimeFrames.php

int NumberOfBarsToForwardPlot = ForecastOverlay.ExtendedArrayElementsToGraph;
if(sc.Index >= sc.ArraySize)
{
for (int i = sc.ArraySize;i < sc.ArraySize + NumberOfBarsToForwardPlot ;i++)
{
ForecastOverlay[i] = PriceArray[i];
}
}

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2014-01-14 07:17:06