Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Passing a secondary bars object to a custom indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Passing a secondary bars object to a custom indicator

    Hi there,

    I can see from this example that it's pretty easy to pass a secondary bars object to a NT indicator (CCI):

    Code:
    protected override void OnBarUpdate()
    {
        // Checks to ensure all Bars objects contain enough bars before beginning
        if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired || CurrentBars[2] <= BarsRequired)
            return;
     
        if (BarsInProgress == 0)
        {
            if (CCI(20)[0] > 200 && CCI(BarsArray[1], 20)[0] > 200
              && CCI(BarsArray[2], 20)[0] > 200)
             {
                  // Do something
             }
        }
    }
    However, I'd like to know how to pass a secondary bars object to a custom indicator.

    For example, if the condition was:

    Code:
     if (Opens[0][0] < MyCustomIndicator(Period, StdDevThresh).VSLow[0]
                    && Position.MarketPosition != MarketPosition.Long)
                {
                    EnterLong(amount, "EnterLongOpen");
                }
    How would I pass a secondary bars object to this indicator in the same way that it has been done for the CCI indicator:

    Code:
    CCI(BarsArray[1], 20)[0]

    Thanks

    #2
    Scotty, that would be just done in the same manner - any indicator method, also your custom one, will per default offer an overload as well that would allow to pass an IDataSeries in like you have shown for the CCI call. So I would expect that to be working for you -

    Code:
    MyCustomIndicator(BarsArray[1], Period, StdDevThresh).VSLow[0]

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X