I have the following code outside of OnBarUpdate(), this is in OnMyButtonClick(). Because of this I believe I need to use TriggerCustomEvent(). I've used this in the past in this section with success but this time I have multiple data series and while debugging it looks like I need to change this code to point to the primary data series.
TriggerCustomEvent( o =>
{
if(Swing(swingStrength).SwingHighBar(0, 1, CurrentBar) > 0 && Swing(swingStrength).SwingLowBar(0, 1, CurrentBar) > 0)
{
swingHiPrice = Highs[0][Swing(swingStrength).SwingHighBar(0, 1, CurrentBar)];
barsSinceSwingHi = Swing[B](Highs[0][0],[/B] swingStrength).SwingHighBar(0, 1, CurrentBar);
}
|
MAX(High, barsSinceSwingHi)[0] <= swingHiPrice
I was thinking that I could just pass Highs[0][0] into the bars since function but that doesn't seem to work.

Comment