Support Board
Date/Time: Sun, 24 Nov 2024 09:40:13 +0000
Post From: open range question (for users as well)
[2013-10-11 20:16:55] |
ganz - Posts: 1048 |
Trade2day1 +7.86 +12.18 > beta 4< #include "sierrachart.h" SCDLLName("or_b4"); 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]; SCSubgraphRef op_rng_2h = sc.Subgraph[3]; SCSubgraphRef op_rng_3h = sc.Subgraph[4]; SCSubgraphRef op_rng_5h = sc.Subgraph[5]; SCSubgraphRef op_rng_7h = sc.Subgraph[6]; SCSubgraphRef op_rng_12h = sc.Subgraph[7]; SCSubgraphRef op_rng_2l = sc.Subgraph[8]; SCSubgraphRef op_rng_3l = sc.Subgraph[9]; SCSubgraphRef op_rng_5l = sc.Subgraph[10]; SCSubgraphRef op_rng_7l = sc.Subgraph[11]; SCSubgraphRef op_rng_12l = sc.Subgraph[12]; SCInputRef or_time = sc.Input[0]; if (sc.SetDefaults) { sc.GraphName = "open range"; sc.StudyDescription = "open range >> beta 4 << @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; op_rng_h.Name = "op_rng_high"; op_rng_h.DrawStyle = DRAWSTYLE_DASH; op_rng_h.LineWidth = 2; op_rng_2h.Name = "op_rng_233"; op_rng_2h.DrawStyle = DRAWSTYLE_DASH; op_rng_2h.LineWidth = 2; op_rng_3h.Name = "op_rng_382"; op_rng_3h.DrawStyle = DRAWSTYLE_DASH; op_rng_3h.LineWidth = 2; op_rng_5h.Name = "op_rng_512"; op_rng_5h.DrawStyle = DRAWSTYLE_DASH; op_rng_5h.LineWidth = 2; op_rng_7h.Name = "op_rng_786"; op_rng_7h.DrawStyle = DRAWSTYLE_DASH; op_rng_7h.LineWidth = 2; op_rng_12h.Name = "op_rng_1218"; op_rng_12h.DrawStyle = DRAWSTYLE_DASH; op_rng_12h.LineWidth = 2; op_rng_2l.Name = "op_rng_(233)"; op_rng_2l.DrawStyle = DRAWSTYLE_DASH; op_rng_2l.LineWidth = 2; op_rng_3l.Name = "op_rng_(382)"; op_rng_3l.DrawStyle = DRAWSTYLE_DASH; op_rng_3l.LineWidth = 2; op_rng_5l.Name = "op_rng_(512)"; op_rng_5l.DrawStyle = DRAWSTYLE_DASH; op_rng_5l.LineWidth = 2; op_rng_7l.Name = "op_rng_(786)"; op_rng_7l.DrawStyle = DRAWSTYLE_DASH; op_rng_7l.LineWidth = 2; op_rng_12l.Name = "op_rng_(1218)"; op_rng_12l.DrawStyle = DRAWSTYLE_DASH; op_rng_12l.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 = 0; // 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; float& OpRange = sc.PersistVars->f5; sc.GetOHLCOfTimePeriod(dt_StartTime, dt_EndTime, Open, High, Low, Close, NextOpen) ; OpRange = High - Low; op_open [sc.Index] = Open; op_rng_h[sc.Index] = High; op_rng_l[sc.Index] = Low; if ( Close >= Open) { op_rng_2h[sc.Index] = High + OpRange*2.33; op_rng_3h[sc.Index] = High + OpRange*3.82; op_rng_5h[sc.Index] = High + OpRange*5.12; op_rng_7h[sc.Index] = High + OpRange*7.86; op_rng_12h[sc.Index]= High + OpRange*12.18; op_rng_2l[sc.Index] = High - OpRange*2.33; op_rng_3l[sc.Index] = High - OpRange*3.82; op_rng_5l[sc.Index] = High - OpRange*5.12; op_rng_7l[sc.Index] = High - OpRange*7.86; op_rng_12l[sc.Index]= High - OpRange*12.18; } else { op_rng_2h[sc.Index] = Low + OpRange*2.33; op_rng_3h[sc.Index] = Low + OpRange*3.82; op_rng_5h[sc.Index] = Low + OpRange*5.12; op_rng_7h[sc.Index] = Low + OpRange*7.86; op_rng_12h[sc.Index]= Low + OpRange*12.18; op_rng_2l[sc.Index] = Low - OpRange*2.33; op_rng_3l[sc.Index] = Low - OpRange*3.82; op_rng_5l[sc.Index] = Low - OpRange*5.12; op_rng_7l[sc.Index] = Low - OpRange*7.86; op_rng_12l[sc.Index]= Low - OpRange*12.18; } } Date Time Of Last Edit: 2013-10-11 20:17:19
|