Support Board
Date/Time: Sun, 22 Dec 2024 22:28:55 +0000
Post From: Displaying Current Bar's Bid/Ask Differential In Text
[2013-08-16 19:46:47] |
ganz - Posts: 1048 |
ged hi try this simple study. i've added some comments. #include <windows.h> #include "sierrachart.h" SCDLLInit("abt"); SCSFExport scsf_abt(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "abt"; sc.StudyDescription = "abt @ganz"; sc.Subgraph[0].Name = "delta"; sc.Subgraph[0].SecondaryColorUsed = 1; sc.Subgraph[0].PrimaryColor = RGB(0,255,0); sc.Subgraph[0].SecondaryColor = RGB(255,0,0); sc.Subgraph[0].LineWidth = 8; sc.Subgraph[0].DrawStyle = DRAWSTYLE_CUSTOM_TEXT; sc.GraphRegion = 1; sc.ValueFormat = 0; sc.AutoLoop = 1; sc.FreeDLL = 1; // set it to 0 for best performance return; } // this is the formula int delta = sc.BaseData[SC_ASKVOL][sc.Index] - sc.BaseData[SC_BIDVOL][sc.Index]; SCString Output; s_UseTool Tool; Tool.Clear(); Tool.ChartNumber = sc.ChartNumber; Tool.Region = sc.GraphRegion; Tool.DrawingType = DRAWING_TEXT; Tool.ReverseTextColor = 0; // text position // horizontal = current Index Tool.BeginIndex = sc.Index; // vertical = HIGH + offset Tool.BeginValue = sc.BaseData[SC_HIGH][sc.Index] + 0.0005; //set the offset here // the condition to choose text color if ( delta >= 0 ) Tool.Color = sc.Subgraph[0].PrimaryColor; else Tool.Color = sc.Subgraph[0].SecondaryColor; Tool.FontFace = "Arial"; Tool.FontSize = sc.Subgraph[0].LineWidth; // font shape Tool.FontBold = true; Tool.LineNumber = 123456; Tool.AddMethod = UTAM_ADD_OR_ADJUST; Tool.TextAlignment = DT_CENTER; sc.FormatString(Output, "%i", delta); Tool.Text = Output; sc.UseTool(Tool); } gd lck Date Time Of Last Edit: 2013-08-16 19:47:48
|
abt.cpp - Attached On 2013-08-16 19:47:42 UTC - Size: 1.57 KB - 455 views |