Support Board
Date/Time: Sun, 24 Nov 2024 09:58:31 +0000
Post From: open range question (for users as well)
[2013-10-08 12:09:56] |
ganz - Posts: 1048 |
Trade2day1 In case you are using a time-based chart w 1- or 5- min bars then there is the simple example using sc.GetOHLCOfTimePeriod: http://s1.ipicture.ru/uploads/20131008/JU0htnkG.png #include "sierrachart.h" SCDLLName("or_b1"); SCSFExport scsf_or(SCStudyInterfaceRef sc) { SCSubgraphRef op_rng_h = sc.Subgraph[0]; SCSubgraphRef op_rng_l = sc.Subgraph[1]; SCInputRef or_time = sc.Input[0]; if (sc.SetDefaults) { sc.GraphName = "open range"; sc.StudyDescription = "open range >> beta 1 << @ganz"; op_rng_h.Name = "op_rng_high"; op_rng_h.DrawStyle = DRAWSTYLE_DASH; op_rng_h.PrimaryColor = RGB(0,255,0); op_rng_h.LineWidth = 2; op_rng_l.Name = "op_rng_low"; op_rng_l.DrawStyle = DRAWSTYLE_DASH; op_rng_l.PrimaryColor = RGB(255,0,0); op_rng_l.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; float NextOpen; sc.GetOHLCOfTimePeriod(dt_StartTime, dt_EndTime, Open, High, Low, Close, NextOpen) ; op_rng_h[sc.Index] = High; op_rng_l[sc.Index] = Low; } pls let me know if this is not the case Date Time Of Last Edit: 2013-10-08 12:10:30
|