Support Board
Date/Time: Mon, 06 May 2024 17:24:39 +0000
Post From: ASCIL DOM Study change Label value and ladder location on each tic
[2018-12-12 06:39:47] |
User153286 - Posts: 44 |
UPDATE - I figured out my issue which turned out to be 2 fold 1.) I was plotting Close/Last but thinking Bid/Ask so it was working just fine but.... 2.) I had the Data value to plot and Location to plot at mixed up which I only noticed after I started working on it again Here is working code: (big trees come from little acorns) Remember You need to have the "Label Column" in the DOM Trade->Customize Chart/Trade DOM Columns #include "sierrachart.h" SCDLLName("Custom Study DLL") /*==========================================================================*/ SCSFExport scsf_DepthOfMarketData(SCStudyInterfaceRef sc) //scsf_DOMAccess { SCSubgraphRef MyGraph= sc.Subgraph[0]; if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "DOM Label example "; sc.StudyDescription = "DOM Label example "; sc.GraphRegion = 0; // overlays on main graph sc.AutoLoop = 0; // do not understand this and the docs suck on this subject sc.UsesMarketDepthData = 1; // access DOM data MyGraph.Name = "MyGraph"; MyGraph.PrimaryColor = RGB(255,0,0); // the following are in the help docs and are the magic that make it work, sorta smells like a hack, but it works! MyGraph.DrawStyle = DRAWSTYLE_SUBGRAPH_NAME_AND_VALUE_LABELS_ONLY; MyGraph.LineLabel = LL_DISPLAY_VALUE | LL_VALUE_ALIGN_DOM_LABELS_COLUMN | LL_DISPLAY_CUSTOM_VALUE_AT_Y; return; } // Do data processing int aindex = sc.ArraySize-1; // most current bar if you will float bidprice = sc.Bid; float thevalue = (float) sc.GetBidMarketDepthStackPullValueAtPrice(bidprice); // again buried in the docs and is how to get the data and location defined on/in ladder MyGraph.Data[aindex] = thevalue; // value must be a number and displays with 2 decimals MyGraph.Arrays[0][aindex] = bidprice; // ladder location or price //debug // SCString Buffer; // Buffer.Format("bidprice=%f thevalue=%f",bidprice, thevalue); // sc.AddMessageToLog(Buffer,1); } |