The divergence indicator plots lines on both the main symbol and the indicator in panel 2 showing where, for example, the main symbol is rising while the indicator in panel 2 is falling.
The divergence lines are plotted using the following two instructions:
Draw.Line(this,"BLDmain"+AA+BB,true,CurrentBar-PivLBar[i],PivotLow_FloatArray[i], CurrentBar-PivLBar[1], PivotLow_FloatArray[1],BullishDivBrush,DashStyleHelper.Dot, DivergenceLineWidth,true); Draw.Line(this,"BLDcomp"+CC+DD,true,CurrentBar-PivLSRBar[i],PivotStoRSI[i], CurrentBar-PivLSRBar[1], PivotStoRSI[1],BullishDivBrush,DashStyleHelper.Dot, DivergenceLineWidth,false);
This indicator works well in all cases except one.
If I plot a second data series in panel 2 rather than a calculated value (e.g. I have ES in the main price panel and NQ in panel 2), then instead of plotting one divergence line on ES in the main panel and one on NQ in panel 2, it plots both divergence lines in panel 2.
The divergence indicator is clearly calculating the divergences correctly because the two lines it plots are in locations where divergence was present and the plotted lines are in opposite directions, i.e. one is rising and the other falling.
The only problem is that the divergence line that should be in the main price panel is in panel 2
As you can see, the first Draw.Line instruction has the DrawInPricePanel parameter set to true so I would expect that line to be drawn in the main panel on the ES data series. However, it seems that the addition of a second data series causes that second data series' location to be treated as the main price panel as far as the Draw.Line instruction is concerned..
I would appreciate any guidance on how to fix this problem.
Thanks.
Comment