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 rhyminkevin, Today, 04:58 PM
        3 responses
        48 views
        0 likes
        Last Post Anfedport  
        Started by iceman2018, Today, 05:07 PM
        0 responses
        5 views
        0 likes
        Last Post iceman2018  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        7 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        14 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        50 views
        0 likes
        Last Post futtrader  
        Working...
        X