Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 15:25:33 +0000



Post From: open range question (for users as well)

[2013-10-11 17:49:06]
ganz - Posts: 1048
Trade2day1

hi

now we know it ACSIL memeber to access a certain file record from *.scid

so i don't know an easy way to get a Close/Opne/etc value from *.scid directly.

and this means we need 1- or 5- min chart for this study and overlay it to the basic chart

and you are able to modify *.cpp as you need it, to use subgraphs and multiply them

this is > beta 2 <


#include "sierrachart.h"

SCDLLName("or_b2");

SCSFExport scsf_or(SCStudyInterfaceRef sc)
{
  SCSubgraphRef op_rng_h     = sc.Subgraph[1];
  SCSubgraphRef op_rng_l     = sc.Subgraph[2];
  SCSubgraphRef op_open     = sc.Subgraph[0];
  SCInputRef     or_time     = sc.Input[0];

  if (sc.SetDefaults)
  {
    sc.GraphName       = "open range";
    sc.StudyDescription   = "open range >> beta 2 << @ganz";

    op_open.Name       = "op_rng_Open";
    op_open.DrawStyle     = DRAWSTYLE_DASH;
    op_open.PrimaryColor   = RGB(255,255,255);
    op_open.LineWidth     = 2;
    
    op_rng_l.Name       = "op_rng_low";
    op_rng_l.DrawStyle     = DRAWSTYLE_DASH;    
    op_rng_l.LineWidth     = 2;
    
    op_rng_h.Name       = "op_rng_high";
    op_rng_h.DrawStyle     = DRAWSTYLE_DASH;    
    op_rng_h.LineWidth     = 2;
    
    or_time.Name       = "Open range (seconds)";
    or_time.SetInt(299);
    or_time.SetIntLimits(0, 2123456789);
        
    sc.GraphRegion       = 0;    
    sc.AutoLoop       = 1;
    sc.FreeDLL         = 1; // set it to zero for high perf
    
    return;
  }
      
  SCDateTime dt_StartTime, dt_EndTime;
  
  dt_StartTime.SetDate(sc.GetTradingDayDate(sc.BaseDateTimeIn[sc.Index]));
  dt_EndTime.SetDate(sc.GetTradingDayDate(sc.BaseDateTimeIn[sc.Index]));
  
  dt_StartTime.SetTime(sc.StartTime1);
  dt_EndTime.SetTime(sc.StartTime1 + or_time.GetInt());  

  float& High     = sc.PersistVars->f1;
  float& Low       = sc.PersistVars->f2;
  float& Open      = sc.PersistVars->f3;  
  float& Close    = sc.PersistVars->f4;
  
  float NextOpen;  

  sc.GetOHLCOfTimePeriod(dt_StartTime, dt_EndTime, Open, High, Low, Close, NextOpen) ;
  
  // reverse colors for High and Low if Close > Open and vice versa

  if ( Close >= Open ) { op_rng_h.PrimaryColor = RGB(0,255,0); op_rng_l.PrimaryColor   = RGB(255,0,0); }
  else { op_rng_h.PrimaryColor = RGB(255,0,0); op_rng_l.PrimaryColor   = RGB(0,255,0); }
  
  op_open [sc.Index] = Open;
  op_rng_h[sc.Index] = High;
  op_rng_l[sc.Index] = Low;  
  
}