Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multi timeframe and TSSuperTrend

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

    multi timeframe and TSSuperTrend

    I get the following error in my log and the reference to BarsArray[1] for TSSuperTrend is ignored. What may I be doing wrong. Is it because TSSuperTrend is returning a bool for the Bar object?

    Error on calling the "OnBarUpdate" method for indicator "TSSuperTrend on bar 1:Object reference not set to an instance of an object.

    Code snipet follows: THANK YOU, Howard

    protectedoverridevoid Initialize()
    {
    Add(PeriodType.Minute, Series2); // series 2 passed to strategy


    protectedoverridevoid OnBarUpdate()
    {
    if (BarsInProgress != 0)
    {
    return;
    }
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    SetStopLoss(
    "", CalculationMode.Ticks, StopLoss, false);
    //stopTaken = false;
    entryPrice = 0.00;
    }

    // Condition set 1
    if (TSSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[0]
    && !TSSuperTrend(
    14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[1]
    && Position.MarketPosition == MarketPosition.Flat
    && TSSuperTrend(BarsArray[
    1], 14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[1]
    )

    #2
    um

    um... i made the changes based on the post that provided for "signal" bssignal data series and now it appears the error is no longer and it is respecting the use of TSsupertrend with multi timeframes. Unless someone else sees something amiss i do believe i've got it. (gollly)

    Comment


      #3
      um um

      disregard last um. Problem still exists. i get object reference not set to an instance of the object. HELP

      Comment


        #4
        ohowie, unfortunately we're not familiar with the addon indicator call you try to work into a multitimeframe environment - I would suggest contacting the original author to clarify.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        63 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        54 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        61 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        48 views
        0 likes
        Last Post CarlTrading  
        Working...
        X