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 PaulMohn, Today, 03:49 AM
        0 responses
        3 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        2 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X