Support Board
Date/Time: Fri, 22 Nov 2024 10:16:34 +0000
Post From: sc.GetContainingIndexForSCDateTime() qstn
[2013-04-25 06:35:13] |
ganz - Posts: 1048 |
Dear Support. 1. Maybe it's not a big deal but v967 This is the very simple study: #include "sierrachart.h" SCDLLInit("indx_b1"); SCSFExport scsf_indx_b1(SCStudyInterfaceRef sc) { SCSubgraphRef indx_b1 = sc.Subgraph[0]; if (sc.SetDefaults) { sc.GraphName = "indx_b1"; sc.StudyDescription = "indx_b1 >>beta 1<< @ganz"; indx_b1.Name = "indx_b1"; indx_b1.DrawStyle = DRAWSTYLE_BAR; indx_b1.PrimaryColor = RGB(255,255,0); indx_b1.LineWidth = 4; sc.GraphRegion = 1; sc.AutoLoop = 1; sc.FreeDLL = 1; } SCDateTime NextDate; int NextIndex; sc.DataStartIndex = 100; if ( sc.DailyDataBarPeriod == 1 ) { for ( int count = 1 ; count <= 3; count ++ ) { NextDate = sc.BaseDateTimeIn[sc.Index] - count*7*DAYS; NextIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, NextDate); indx_b1[sc.Index] = NextIndex; } } else return; } It works well without NextIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, NextDate); this indx_b1[sc.Index] = NextDate.GetDate(); works fine It works very well if sc.GetContainingIndexForSCDateTime() has been added to the code and the study is on a daily chart already but it crashes SC if I try to add the study on the clean daily chart so I assume there is some issue w sc.GetContainingIndexForSCDateTime() 2. Second question is I'm not able to change the periodicity from an intraday to historical w Chart Settings. Thank you for any assistance. ps: {code}{/code} transfers > and < to < Date Time Of Last Edit: 2013-04-25 06:40:13
|