Login Page - Create Account

Support Board


Date/Time: Fri, 14 Mar 2025 13:28:35 +0000



Post From: Footprint Chart - Indicator for imbalance

[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