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 Jonafare, 12-06-2012, 03:48 PM
        5 responses
        3,986 views
        0 likes
        Last Post rene69851  
        Started by Fitspressorest, Today, 01:38 PM
        0 responses
        2 views
        0 likes
        Last Post Fitspressorest  
        Started by Jonker, Today, 01:19 PM
        0 responses
        2 views
        0 likes
        Last Post Jonker
        by Jonker
         
        Started by futtrader, Today, 01:16 PM
        0 responses
        8 views
        0 likes
        Last Post futtrader  
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,792 views
        0 likes
        Last Post aligator  
        Working...
        X