Login Page - Create Account

Support Board


Date/Time: Fri, 14 Mar 2025 07:04:18 +0000



[Programming Help] - Footprint Chart - Indicator for imbalance

View Count: 969

[2022-06-15 15:22:00]
countryboy92 - Posts: 91
I am using a footprint chart and at the bottom I have added the buyer/seller imbalance amount (red/green) for each candle. Is there a way to add an indicator when the buyer/seller imbalance is does not correlate with the direction of the candle? I want to see when for instance I have buyer imbalance but I have a down red candle.
[2022-06-16 08:55:05]
User310645 - Posts: 49
There may well be a way to do it with vanilla Sierra but its trivial to write something of your own.

This takes the delta subgraph (SG1) of a number bar calc values study on the FP chart as an input to get the delta and plots an up arrow if a HH is made (since the last up bar) on the current up bar with negative delta and vice-versa.

You could just remove the HH,LL (eg. sc.High[Index] > sc.High[Index-2]) checks for your case.

EDIT: I should have added I use P&F so you will have to use another direction indicator method (which I can't remember currently) than PF_DIRECTION_ARRAY.


SCSFExport scsf_DeltaDivergence(SCStudyInterfaceRef sc)
{

  SCSubgraphRef OutputDown = sc.Subgraph[0];
  SCSubgraphRef OutputUp = sc.Subgraph[1];

  SCInputRef NumBars = sc.Input[1];
  SCInputRef Offset = sc.Input[2];

  if (sc.SetDefaults)
  {
    sc.AutoLoop = 1;
    sc.GraphName = "Delta Divergence";
    sc.GraphRegion = 0;

    OutputDown.Name = "Down Divergence";
    OutputDown.DrawStyle = DRAWSTYLE_ARROW_DOWN;
    OutputDown.PrimaryColor = RGB(255, 0, 0);

    OutputUp.Name = "Up Divergence";
    OutputUp.DrawStyle = DRAWSTYLE_ARROW_UP;
    OutputUp.PrimaryColor = RGB(0, 255, 0);

    NumBars.Name = "Num bars calc values study";
    NumBars.SetChartStudySubgraphValues(sc.ChartNumber, 13, 1);

    Offset.Name = "Bar offset (ticks)";
    Offset.SetFloat(0.05f);

    return;
  }

  SCFloatArray Delta;
  sc.GetStudyArrayFromChartUsingID(NumBars.GetChartStudySubgraphValues(), Delta);

  if (sc.BaseData[PF_DIRECTION_ARRAY][sc.Index] == 1) {
    OutputDown[sc.Index] = sc.High[sc.Index] > sc.High[sc.Index - 2] &&
      Delta[sc.Index] < 0 ? sc.High[sc.Index] + Offset.GetFloat() : 0;
  }
  else {
    OutputUp[sc.Index] = sc.Low[sc.Index] < sc.Low[sc.Index - 2] &&
      Delta[sc.Index] > 0 ? sc.Low[sc.Index] - Offset.GetFloat() : 0;
  }

}

Date Time Of Last Edit: 2022-06-16 09:00:41
[2022-06-16 10:56:10]
User431178 - Posts: 613
Example attached
attachmentDeltaDivergence.Cht - Attached On 2022-06-16 10:56:04 UTC - Size: 4.62 KB - 255 views
[2022-06-16 19:23:33]
countryboy92 - Posts: 91
User431178: I like you're chart and I'm not much of a programmer. Is there an easy way to add a total volume to each candle in your chart?
[2022-06-17 07:41:02]
User431178 - Posts: 613
Modified chart to show volume below bar and delta above.
attachmentDeltaDivergence.Cht - Attached On 2022-06-17 07:40:52 UTC - Size: 5.04 KB - 183 views
[2022-06-17 16:30:34]
countryboy92 - Posts: 91
User431178 How do I change the color of the candlestick outline in the footprint? Up is blue and down is pink, and I want a green and red outline.
[2022-06-18 10:20:19]
User431178 - Posts: 613
You can find the info about number bars at these links
https://www.sierrachart.com/index.php?page=doc/NumbersBars.php#s328
Numbers Bars: Drawing Open to Close Boxes on Side of Numbers Bar

The particular settings are Open Marker / Up Box Color and Close Marker / Down Box Color

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

Login

Login Page - Create Account