SCSFExport scsf_CumulativeDeltaBarsTicks(SCStudyInterfaceRef sc) { SCSubgraphRef Subgraph_Open = sc.Subgraph[SC_OPEN]; SCSubgraphRef Subgraph_High = sc.Subgraph[SC_HIGH]; SCSubgraphRef Subgraph_Low = sc.Subgraph[SC_LOW]; SCSubgraphRef Subgraph_Close = sc.Subgraph[SC_LAST]; SCSubgraphRef Subgraph_OHLCAvg = sc.Subgraph[SC_OHLC_AVG]; SCSubgraphRef Subgraph_HLCAvg = sc.Subgraph[SC_HLC_AVG]; SCSubgraphRef Subgraph_HLAvg = sc.Subgraph[SC_HL_AVG]; SCInputRef Input_ResetAtSessionStart = sc.Input[2]; SCInputRef Input_ResetAtBothSessionStarts = sc.Input[3]; if (sc.SetDefaults) { sc.GraphName = "Cumulative Delta Bars - Trades"; sc.MaintainAdditionalChartDataArrays = 1; sc.AutoLoop = 0;//Manual looping sc.ValueFormat = 0; sc.GraphDrawType = GDT_CANDLESTICK; Subgraph_Open.Name = "Open"; Subgraph_Open.DrawStyle = DRAWSTYLE_LINE; Subgraph_Open.PrimaryColor = RGB(0,255,0); Subgraph_Open.SecondaryColor = RGB(0,255,0); Subgraph_Open.SecondaryColorUsed = true; Subgraph_Open.DrawZeros = true; Subgraph_High.Name = "High"; Subgraph_High.DrawStyle = DRAWSTYLE_LINE; Subgraph_High.PrimaryColor = RGB(0,128,0); Subgraph_High.DrawZeros = true; Subgraph_Low.Name = "Low"; Subgraph_Low.DrawStyle = DRAWSTYLE_LINE; Subgraph_Low.PrimaryColor = RGB(255,0,0); Subgraph_Low.SecondaryColor = RGB(255,0,0); Subgraph_Low.SecondaryColorUsed = true; Subgraph_Low.DrawZeros = true; Subgraph_Close.Name = "Close"; Subgraph_Close.DrawStyle = DRAWSTYLE_LINE; Subgraph_Close.PrimaryColor = RGB(128,0,0); Subgraph_Close.DrawZeros = true; Subgraph_OHLCAvg.Name = "OHLC Avg"; Subgraph_OHLCAvg.DrawStyle = DRAWSTYLE_IGNORE; Subgraph_OHLCAvg.PrimaryColor = COLOR_GREEN; Subgraph_OHLCAvg.DrawZeros = true; Subgraph_HLCAvg.Name = "HLC Avg"; Subgraph_HLCAvg.DrawStyle = DRAWSTYLE_IGNORE; Subgraph_HLCAvg.PrimaryColor = COLOR_GREEN; Subgraph_HLCAvg.DrawZeros = true; Subgraph_HLAvg.Name = "HL Avg"; Subgraph_HLAvg.DrawStyle = DRAWSTYLE_IGNORE; Subgraph_HLAvg.PrimaryColor = COLOR_GREEN; Subgraph_HLAvg.DrawZeros = true; Input_ResetAtSessionStart.Name = "Reset at Start of Trading Day"; Input_ResetAtSessionStart.SetYesNo(1); Input_ResetAtBothSessionStarts.Name = "Reset at Both Session Start Times"; Input_ResetAtBothSessionStarts.SetYesNo(false); return; } for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++) { bool Reset = false; if (Index == 0) Reset = true; else if (Input_ResetAtBothSessionStarts.GetYesNo() != 0 ) { SCDateTime PriorStartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index - 1], TIME_PERIOD_LENGTH_UNIT_DAYS ,1,0,1); SCDateTime StartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index], TIME_PERIOD_LENGTH_UNIT_DAYS ,1,0,1); if (StartOfPeriod != PriorStartOfPeriod) Reset = true; } else if (Input_ResetAtSessionStart.GetYesNo() != 0 ) { SCDateTime PriorStartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index - 1], TIME_PERIOD_LENGTH_UNIT_DAYS, 1, 0, 0); SCDateTime StartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index], TIME_PERIOD_LENGTH_UNIT_DAYS, 1, 0, 0); if (StartOfPeriod != PriorStartOfPeriod) Reset = true; } sc.CumulativeDeltaTicks(sc.BaseDataIn, Subgraph_Close, Index, Reset); Subgraph_Open[Index] = Subgraph_Close.Arrays[0][Index]; Subgraph_High[Index] = Subgraph_Close.Arrays[1][Index]; Subgraph_Low[Index] = Subgraph_Close.Arrays[2][Index]; sc.CalculateOHLCAverages(Index); } }