Login Page - Create Account

Support Board


Date/Time: Tue, 23 Apr 2024 06:48:13 +0000



[User Discussion] - Unable to use drawing tool on custom chart with Bars displayed as main price

View Count: 1614

[2013-09-03 03:50:09]
maxpi - Posts: 175
I have a study that works fine, it displays bars that are greater in duration than the underlying [1T] chart. I can apply a study to the chart and it displays the study based on the bars I build as it should. I cannot apply a drawing to the chart with the mouse though. Should that be the case? The defaults are:

if (sc.SetDefaults)
  {
    // Set the defaults
    
    sc.GraphName ="ACodeThingyToTestRxCode";
    
    // This member indicates that this is a custom chart study.
    //  This can only be set when SetDefaults is true.
    sc.IsCustomChart       =1;    
    sc.GraphRegion         =0;    
    sc.DrawZeros         =0;    
    sc.GraphDrawType       =GDT_CANDLESTICK;
    sc.DisplayAsMainPriceGraph  =1;
    sc.FreeDLL           =1;
    sc.AutoLoop         =0;
    sc.ValueFormat         =VALUEFORMAT_INHERITED;
    sc.StandardChartHeader     =1;
    
    
    // Subgraphs

    Open.Name ="Open";
    Open.DrawStyle =DRAWSTYLE_LINE;

    High.Name ="High";
    High.DrawStyle =DRAWSTYLE_LINE;

    Low.Name ="Low";
    Low.DrawStyle =DRAWSTYLE_LINE;

    Last.Name ="Last";
    Last.DrawStyle =DRAWSTYLE_LINE;

    

    return;
  }


Edit: I did a little more checking, I can indeed draw a line, cannot draw a linear regression channel. Maybe if there is a problem it's just with that one tool...
Date Time Of Last Edit: 2013-09-03 03:56:41
[2013-09-04 02:38:20]
maxpi - Posts: 175
This code builds some 100 tick bars when applied to a 1T chart. I can draw a line on the produced bars but I cannot draw a linear regression channel.

#include "sierrachart.h"

/*==========================================================================*/
SCDLLName("Custom Study DLL")
SCSFExport scsf_RxSubgraphBars(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 defaults
    
    sc.GraphName ="ForumCodeForBars";
    
    // This member indicates that this is a custom chart study.
    //  This can only be set when SetDefaults is true.
    sc.IsCustomChart       =1;    
    sc.DisplayAsMainPriceGraph  =1;
    sc.GraphRegion         =0;    
    sc.GraphDrawType       =GDT_CANDLESTICK;
    sc.ValueFormat         =VALUEFORMAT_INHERITED;
    sc.DrawZeros         =0;    
    sc.FreeDLL           =1;
    sc.AutoLoop         =0;
    sc.StandardChartHeader     =1;
    
    // Subgraphs

    Open.Name ="Open";
    Open.DrawStyle =DRAWSTYLE_LINE;

    High.Name ="High";
    High.DrawStyle =DRAWSTYLE_LINE;

    Low.Name ="Low";
    Low.DrawStyle =DRAWSTYLE_LINE;

    Last.Name ="Last";
    Last.DrawStyle =DRAWSTYLE_LINE;
    
    return;
  }
  
  for(int i =0; i<sc.ArraySize; i++)
  {
    if(i % 100 ==0)
    {
      sc.AddElements(1);
      sc.DateTimeOut[sc.OutArraySize -1] =sc.BaseDateTimeIn;
      High[sc.OutArraySize -1]      =0;
      Low[sc.OutArraySize -1]       =999999;
      Open[sc.OutArraySize -1]       =sc.Open;
      
      if(sc.High >High[sc.OutArraySize -1])
      {
        High[sc.OutArraySize -1] =sc.High;
      }
      
      if(sc.Low <Low[sc.OutArraySize -1])
      {
        Low[sc.OutArraySize -1] =sc.Low;
      }
    }
    Last[sc.OutArraySize -1] =sc.Close;
    i++;
  }
}

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account