Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy help

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

    Strategy help

    I would like to code for a strategy as follows: close of the present bar is less than the close of the previous 8 bars. Thanks for the help

    #2
    Hello snotrag12,

    You may do this my manually checking the Close of the current bar with each bar manually, or you may use the MIN() method to be able to find the lowest value over a given period to be able to do this as well.

    Here is a link to our Help Guide that goes over the MIN method that you may view.
    JCNinjaTrader Customer Service

    Comment


      #3
      More problems

      Hi I tried to incorporate max into line 71 of my strategy, but I have some compilation errors.
      I am trying to code if the high of stochastic K over the past 10 bars is greater than 80. Appreciate the help
      Attached Files

      Comment


        #4
        Hello snotrag12,

        Thanks for the screenshot.

        This is because the second part of your statement on Condition 4 is invalid. You are reference the Stochastics K value and then placing a comma. If you would like to find the high value of the Stochastic you would replace the "High" with the Stochastic K.

        Example:

        Code:
        if(Stochastics(7,14,3).K [0] < 75
        				&& MAX(Stochastics(7,14,3).K,10)[0] > 80)
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        64 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Working...
        X