• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Displaced MA in strategy builder

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

    Displaced MA in strategy builder

    How do you displace a MA to the left in strategy builder? I use it on an indicator and it would be a signal line. When it crosses above/below the other MA it paints the bar a specific color. I've got that part but am not successful in the first.

    Thanks

    #2
    Hello dedouglas,

    Thank you for the question.

    In NinjaScript there is no concept of "displacement" you would instead use the BarsAgo concept to reference data from other bars. For example, if you wanted to compare an MA against its self for a different bar value, you would use a BarsAgo of 1 or the number of bars you wanted ago.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Does this work on the cross above/below? I couldn't get my bars to paint until I switch condition to greater then. It was coloring them a bar or two late also and a few in a row until filtered out by other conditions. My goal is to paint the one bar a certain color when the signal line crosses above/below the other. Its an sma of the same period, but I want one offset to the left 1 bar. The input series isn't price but another indicator value if that makes a difference.

      Thanks

      Comment


        #4
        Hello dedouglas,

        The Cross above and below use a Lookback period which is how they would compare crossings. I see you noted you wanted to compare the same SMA of the same period, just offset by 1 bar. In a chart you can do this manually using the Displacement property of the indicator, however, in NinjaSript there is no concept of simply moving the values over. Displacement is just a visual change which moves the existing values in the direction you specified by that number of bars, the values are still all identical and still apply to the same bars they originally did. In NinjaScript you could instead use 1 BarsAgo in this situation, you could compare the SMA against the SMA of 1 bar ago to see fi there was a crossing.

        When configuring the condition, you would enter 1 BarsAgo when configuring the first or second indicator to get the value of 1 bars ago for comparison.



        I look forward to being of further assistance.


        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by digibob, Today, 02:47 AM
        0 responses
        1 view
        0 likes
        Last Post digibob
        by digibob
         
        Started by NinjaCustomer, Today, 12:57 AM
        1 response
        4 views
        0 likes
        Last Post NinjaCustomer  
        Started by lancasterstephen, Today, 12:09 AM
        1 response
        5 views
        0 likes
        Last Post lancasterstephen  
        Started by liltr3d, Yesterday, 10:52 PM
        0 responses
        4 views
        0 likes
        Last Post liltr3d
        by liltr3d
         
        Started by Longhornmark, Yesterday, 08:25 AM
        3 responses
        13 views
        0 likes
        Last Post bltdavid  
        Working...
        X