Support Board
Date/Time: Sun, 02 Nov 2025 17:07:32 +0000
Post From: ASCIL use time and sales on multiple studies
| [2025-09-25 09:57:35] |
| Smitty7_NZ - Posts: 5 |
|
this is with a user defined symbol SCSFExport scsf_VAPInLabel(SCStudyInterfaceRef sc) { SCInputRef i_FontSize = sc.Input[0]; SCInputRef i_BoldFont = sc.Input[1]; SCInputRef i_TextColor = sc.Input[2]; SCInputRef i_Background = sc.Input[3]; SCInputRef i_xOffset = sc.Input[4]; SCInputRef i_yOffset = sc.Input[5]; SCInputRef i_NumDigits = sc.Input[6]; SCInputRef i_LastTradeFg = sc.Input[7]; SCInputRef i_LastTradeBg = sc.Input[8]; SCInputRef i_TargetColumn = sc.Input[9]; SCInputRef i_GridlineColor = sc.Input[10]; SCInputRef i_OverallYOffset= sc.Input[11]; SCInputRef i_LastFontSize = sc.Input[12]; SCInputRef i_LastBold = sc.Input[13]; SCInputRef i_Symbol = sc.Input[14]; if (sc.SetDefaults) { sc.GraphName = "SVAP"; sc.GraphRegion = 0; i_FontSize.Name = "Font Size"; i_FontSize.SetInt(18); i_BoldFont.Name = "Bold"; i_BoldFont.SetYesNo(0); i_TextColor.Name = "Text Color"; i_TextColor.SetColor(RGB(0,0,0)); i_Background.Name = "Default Background"; i_Background.SetColor(RGB(240,240,240)); i_xOffset.Name = "X Offset"; i_xOffset.SetInt(8); i_yOffset.Name = "Y Offset"; i_yOffset.SetInt(0); i_NumDigits.Name = "Digits"; i_NumDigits.SetInt(0); i_LastTradeFg.Name = "Last Trade Text"; i_LastTradeFg.SetColor(RGB(0,0,0)); i_LastTradeBg.Name = "Last Trade Neutral Background"; i_LastTradeBg.SetColor(RGB(200,200,200)); i_TargetColumn.Name = "Target Column"; i_TargetColumn.SetCustomInputStrings("Label;General Purpose 1;General Purpose 2;"); i_TargetColumn.SetCustomInputIndex(0); i_GridlineColor.Name = "Gridline"; i_GridlineColor.SetColor(RGB(192,192,192)); i_OverallYOffset.Name = "Overall Y-Offset"; i_OverallYOffset.SetInt(15); i_LastFontSize.Name = "Last Trade Font Size"; i_LastFontSize.SetInt(20); i_LastBold.Name = "Last Trade Bold"; i_LastBold.SetYesNo(1); i_Symbol.Name = "Symbol"; i_Symbol.SetString("ESZ25-CME"); return; } SCString Symbol = sc.Input[14].GetString(); c_SCTimeAndSalesArray TSArray; sc.GetTimeAndSalesForSymbol(Symbol, TSArray); for (int i = 0; i < TSArray.Size(); ++i) { const s_TimeAndSales& ts = TSArray[i]; if (ts.Sequence <= g_LastProcessedSeq) continue; if (ts.Type == SC_TS_BID || ts.Type == SC_TS_ASK) { double tradePrice = sc.RoundToTickSize(ts.Price * sc.RealTimePriceMultiplier, sc.TickSize); int tradeSize = (int)ts.Volume; VolumeAtPrice& vap = g_VolumeAtPrice[tradePrice]; if (ts.Type == SC_TS_BID) vap.BidVol += tradeSize; else vap.AskVol += tradeSize; if (tradePrice != g_LastPrice) { g_PreviousLastPrice = g_LastPrice; g_LastPrice = tradePrice; g_CumLastVol = tradeSize; g_IsFirstTradeAtNewPrice = true; } else { g_CumLastVol += tradeSize; g_IsFirstTradeAtNewPrice = false; } SCString msg; msg.Format("Trade @ %.2f, size=%d, g_CumLastVol=%d", tradePrice, tradeSize, g_CumLastVol); sc.AddMessageToLog(msg, 1); } g_LastProcessedSeq = ts.Sequence; } sc.p_GDIFunction = DrawToChart; } |
