Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Custom indicator not returning correct values

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

    Custom indicator not returning correct values

    I am trying to write my first custom indicator - a very simple displaced moving average (see attached - CentredSMA.zip), but am not sure if I am doing the right thing.
    When I plot the indicator on a chart it looks right. But when I use it in a custom strategy (also attached - SMAMACDv3.zip) and print out the values it is returning they do not match the values shown in the Data Box, and the strategy is not functioning properly.
    Can anyone see what I am doing wrong please?
    Attached Files

    #2
    annettes, please remove any CalculateOnBarClose settings from the Initialize() method of the called indicators (your CenteredSMA), then retry accessing the values from the strategy and check if they hit home then, thanks
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,
      Thanks for the suggestion. I tried it, but unfortunately I am getting exactly the same values I was before.
      Regards,
      Annette

      Comment


        #4
        Annette, just plotted your CenteredSMA, if you look to place trades on this value as charted - this will not be possible, as it's shifted back for historical data, thus giving you the impression to have a non lagging SMA, while those values do not exist when attempting to trade this in realtime.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by strategist007, Today, 07:51 PM
        0 responses
        2 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,967 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Today, 06:48 PM
        0 responses
        4 views
        0 likes
        Last Post rbeckmann05  
        Started by rhyminkevin, Today, 04:58 PM
        4 responses
        57 views
        0 likes
        Last Post dp8282
        by dp8282
         
        Started by iceman2018, Today, 05:07 PM
        0 responses
        6 views
        0 likes
        Last Post iceman2018  
        Working...
        X