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

I'm using series[ offset ] wrong in AddChartIndicator AND Strategy Builder

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

    I'm using series[ offset ] wrong in AddChartIndicator AND Strategy Builder

    Hi All, I'm new to NinjaScript, thanks in advance for helping me surmount the curve!

    I want to plot and trigger trades when the close crosses above the highest high of the previous 3 bar but I have issues in two areas which are surely noob blindness.

    1) strategy builder will not permit me to build CrossAbove(Close,MAX(Close,3)[1], 1)
    see photo 2 and 3

    2) when I try to add a plot to the strategy using AddChartIndicator the offset is not allowed
    see photo 1 where Add Chart Indicator throws an error

    Thanks!


    ps: does the forum software not allow more than 3 images, or is that just preview?
    ps: how to inline the images for better posts?
    Last edited by robforee; 04-10-2020, 08:33 AM.

    #2
    Hello robforfree,

    Thank you for your post.

    It would not be possible to use AddChartIndicator in the first way you have it in your first screenshot. You're telling it to add the data for a single bar when that bar hasn't had anything assigned to it yet - the indicator has not yet begun processing the data. AddChartIndicator would not be able to show the indicator with a visual offset - if you want to see it offset visually, you'd need to add the indicator to the chart separately from the strategy.

    As to your other question, regarding CrossAbove(Close,MAX(Close,3)[1], 1) not working, specifying that it look at the MAX value of a bar ago is what's causing it not to work. You would need to set the BarsAgo for the MAX indicator to 0 so it uses the full MAX series instead of the value of one bar. CrossAbove would be used to check if two series have crossed over one another. MAX(Close,3)[1] is a single value and not the full series from that bar back.

    For the images in the forum, you can add images inline - there's an option for that if you click the underlined A in the upper right of the chart.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thanks Kate,

      So how to I build this logic with the strategy builder?

      IF today's close is higher than highest high of previous 3 days

      Not like this, it generates no trades..
      Click image for larger version

Name:	kate.jpg
Views:	147
Size:	53.7 KB
ID:	1093916

      Comment


        #4
        Hi robforee, thanks for your question.

        I got trades to generate with this condition when using Greater rather than a cross above condition. The cross above is always false because the series doesn't go from below the high price to above the price in 1 bar. If you change Cross above to Greater you will have trades generated.

        Please let me know if I can assist any further.


        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by xiinteractive, 04-09-2024, 08:08 AM
        2 responses
        11 views
        0 likes
        Last Post xiinteractive  
        Started by Irukandji, Today, 09:34 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by RubenCazorla, Today, 09:07 AM
        1 response
        5 views
        0 likes
        Last Post RubenCazorla  
        Started by TraderBCL, Today, 04:38 AM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        11 responses
        1,423 views
        0 likes
        Last Post jculp
        by jculp
         
        Working...
        X