Support Board
Date/Time: Sun, 22 Dec 2024 05:04:51 +0000
Post From: DeltaMomentum Source Code
[2015-07-10 03:05:18] |
Sierra Chart Engineering - Posts: 104368 |
#define ASKCOLOR RGB(255, 128, 128) #define BIDCOLOR RGB(128, 255, 128) #define POSDELTACOLOR RGB(32, 255, 32) #define NEGDELTACOLOR RGB(255, 32, 32) SCSFExport scsf_DeltaMomentum(SCStudyGraphRef sc) { SCSubgraphRef askVol = sc.Subgraph[0]; SCSubgraphRef bidVol = sc.Subgraph[1]; SCSubgraphRef deltaVol = sc.Subgraph[2]; SCSubgraphRef deltaMomentum = sc.Subgraph[3]; if (sc.SetDefaults) { sc.GraphName = "DeltaMomentum"; sc.GraphRegion = 1; sc.ScaleRangeType = SCALE_AUTO; sc.StudyDescription = "DeltaMomentum"; sc.FreeDLL = 0; sc.AutoLoop = 0; // Manual looping askVol.Name = "Ask Volume"; askVol.PrimaryColor = ASKCOLOR; askVol.DrawStyle = DRAWSTYLE_IGNORE; bidVol.Name = "Bid Volume"; bidVol.PrimaryColor = BIDCOLOR; bidVol.DrawStyle = DRAWSTYLE_IGNORE; deltaVol.Name = "Delta"; deltaVol.DrawStyle = DRAWSTYLE_IGNORE; deltaMomentum.Name = "Delta Momentum"; deltaMomentum.PrimaryColor = POSDELTACOLOR; deltaMomentum.SecondaryColor = NEGDELTACOLOR; deltaMomentum.LineWidth = 2; deltaMomentum.DrawStyle = DRAWSTYLE_BAR; deltaMomentum.AutoColoring = AUTOCOLOR_POSNEG; return; } int ind = sc.UpdateStartIndex; if (ind == 0) { askVol[ind] = sc.BaseDataIn[SC_ASKVOL][ind]; bidVol[ind] = -sc.BaseDataIn[SC_BIDVOL][ind]; deltaVol[ind] = askVol[ind] + bidVol[ind]; deltaMomentum[ind] = deltaVol[ind]; ++ind; } for (; ind < sc.ArraySize; ++ind) { askVol[ind] = sc.BaseDataIn[SC_ASKVOL][ind]; bidVol[ind] = -sc.BaseDataIn[SC_BIDVOL][ind]; deltaVol[ind] = askVol[ind] + bidVol[ind]; if (deltaVol[ind] > 0) { if (deltaMomentum[ind-1] >= 0) { deltaMomentum[ind] = deltaMomentum[ind-1] + deltaVol[ind]; } else { deltaMomentum[ind] = deltaVol[ind]; } } else if (deltaVol[ind] < 0) { if (deltaMomentum[ind-1] <= 0) { deltaMomentum[ind] = deltaMomentum[ind-1] + deltaVol[ind]; } else { deltaMomentum[ind] = deltaVol[ind]; } } else { deltaMomentum[ind] = deltaMomentum[ind-1]; } } } Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |