Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 17:34:47 +0000



[User Discussion] - Displaying Current Bar's Bid/Ask Differential In Text

View Count: 3757

[2013-08-16 17:27:39]
ged - Posts: 233
To Support or any user:
On my primary chart, I display the current bar's Ask volume in green text and the current bar's Bid volume in red text.

I would like to display in text the difference between the current bar's Bid and Ask volumes, with the text displaying in green if there is more Ask volume, and in red if there is more Bid volume. I've attempted accomplishing this, but haven't been able to find the correct combination of studies. Can it be done?

Thanks much!
[2013-08-16 18:10:44]
Sawtooth - Posts: 4141
Not exactly.

The closest you'll get is to use 2 instances of the Text Display for Study study, one for the green difference and one for the red difference, and have the green display 0 when the red is displaying a value, and vice versa. The difference and zero values would be achieved with the Spreadsheet Study study.
[2013-08-16 18:29:07]
ged - Posts: 233
That would be a satisfactory solution.

I've never used the Spreadsheet Study so I'll get to learn something new as I work to pull this together.

Thanks very much Tom.
[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
attachmentabt.cpp - Attached On 2013-08-16 19:47:42 UTC - Size: 1.57 KB - 455 views
[2013-08-17 00:45:32]
ged - Posts: 233
Thank you ganz, appreciate it very much. Ged
[2013-08-17 07:31:43]
ganz - Posts: 1048
ged

hi

An SC user have corrected the offset using the proper/more_universal way

So you can change this


// vertical = HIGH + offset
Tool.BeginValue = sc.BaseData[SC_HIGH][sc.Index] + 0.0005; //set the offset here

to


// vertical = HIGH + offset
Tool.BeginValue = sc.BaseData[SC_HIGH][sc.Index] + 5*sc.TickSize; //set the offset here

gd lck
Date Time Of Last Edit: 2013-08-17 07:32:18
[2013-08-17 12:52:11]
ged - Posts: 233
Thanks again ganz. Have a great weekend.
[2013-08-17 14:53:20]
User56762 - Posts: 1
I don't know how to change the colors, but you could add the DeltaMomentum study to your chart and then use the Text Display For Study to display the Delta output by the DeltaMomentum study (Add Custom Study-->User Contributed Studies-->DeltaMomentum). I am using version SC 1007. I put my Delta text display in the same region as the DeltaMomentum study.

http://www.sierrachart.com/image.php?l=1376751153158.png

[2013-08-17 16:57:54]
ged - Posts: 233
Thank you for the suggestion. Appreciate it.
[2013-08-17 18:55:47]
ged - Posts: 233
Tom, I'm going to drop you an email directly regarding the formulas. Ged
Date Time Of Last Edit: 2013-08-17 19:39:46
[2013-09-17 05:35:24]
Moti - Posts: 63
Hello Ged, Hello Sierra Support,

Thank you for helping with this post,

I think that one of the important parameters to recognize reversals and pullback are the DELTA CHANGE in the bid/ask from bar to bar

For example:
If a bar ago the delta was -2662 and this bar the delta is +2157 it means that the "Delta change" is +4819
And this is a meaningful number of buyers coming on the market B-A= delta change

can you help by this calculation in Number bar or any soulotion?

Thank you,

Moti
[2013-09-17 05:47:29]
ganz - Posts: 1048
Moti

http://www.sierrachart.com/index.php?l=doc/doc_NumbersBars.php#SubgraphDescriptions

Ask Volume & Bid Volume Difference Change (AskV - BidV BarDiff): This is the difference between: The Ask Volume minus Bid Volume for the entire Numbers Bar and the Ask Volume minus Bid Volume for the entire prior Numbers Bar.

[2013-09-17 06:05:50]
Moti - Posts: 63
Ganz,

Thank you for quick answer.

Moti
[2015-05-15 16:03:45]
User911705 - Posts: 89
Is there an easy way to change the code above (abt.cpp) so that the text value plots for every bar, not just the current bar?

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account