SCSFExport scsf_CumulativeDeltaBarsTickVolume(SCStudyInterfaceRef sc) { SCSubgraphRef Open = sc.Subgraph[SC_OPEN]; SCSubgraphRef High = sc.Subgraph[SC_HIGH]; SCSubgraphRef Low = sc.Subgraph[SC_LOW]; SCSubgraphRef Close = sc.Subgraph[SC_LAST]; SCSubgraphRef OHLCAvg = sc.Subgraph[SC_OHLC_AVG]; SCSubgraphRef HLCAvg = sc.Subgraph[SC_HLC_AVG]; SCSubgraphRef HLAvg = sc.Subgraph[SC_HL_AVG]; SCInputRef ResetAtSessionStart = sc.Input[2]; SCInputRef ResetAtBothSessionStarts = sc.Input[3]; if (sc.SetDefaults) { sc.GraphName = "Cumulative Delta Bars - Up/Down Tick Volume"; sc.FreeDLL = 0;//Do not release DLL sc.MaintainAdditionalChartDataArrays = 1; sc.AutoLoop = 0;//Manual looping sc.ValueFormat = 0; sc.GraphDrawType = GDT_CANDLESTICK; Open.Name = "Open"; Open.DrawStyle = DRAWSTYLE_LINE; Open.PrimaryColor = RGB(0,255,0); Open.SecondaryColor = RGB(0,255,0); Open.SecondaryColorUsed = true; Open.DrawZeros = true; High.Name = "High"; High.DrawStyle = DRAWSTYLE_LINE; High.PrimaryColor = RGB(0,128,0); High.DrawZeros = true; Low.Name = "Low"; Low.DrawStyle = DRAWSTYLE_LINE; Low.PrimaryColor = RGB(255,0,0); Low.SecondaryColor = RGB(255,0,0); Low.SecondaryColorUsed = true; Low.DrawZeros = true; Close.Name = "Close"; Close.DrawStyle = DRAWSTYLE_LINE; Close.PrimaryColor = RGB(128,0,0); Close.DrawZeros = true; OHLCAvg.Name = "OHLC Avg"; OHLCAvg.DrawStyle = DRAWSTYLE_IGNORE; OHLCAvg.PrimaryColor = COLOR_GREEN; OHLCAvg.DrawZeros = true; HLCAvg.Name = "HLC Avg"; HLCAvg.DrawStyle = DRAWSTYLE_IGNORE; HLCAvg.PrimaryColor = COLOR_GREEN; HLCAvg.DrawZeros = true; HLAvg.Name = "HL Avg"; HLAvg.DrawStyle = DRAWSTYLE_IGNORE; HLAvg.PrimaryColor = COLOR_GREEN; HLAvg.DrawZeros = true; ResetAtSessionStart.Name = "Reset at Start of Trading Day"; ResetAtSessionStart.SetYesNo(1); ResetAtBothSessionStarts.Name = "Reset at Both Session Start Times"; ResetAtBothSessionStarts.SetYesNo(false); return; } for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++) { bool Reset = false; if (Index == 0) Reset = true; else if (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 (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.CumulativeDeltaTickVolume(sc.BaseDataIn, Close, Index, Reset); Open[Index] = Close.Arrays[0][Index]; High[Index] = Close.Arrays[1][Index]; Low[Index] = Close.Arrays[2][Index]; sc.CalculateOHLCAverages(Index); } }