Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy builder issue

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

    Strategy builder issue

    Hello,

    I would like to test a simple strategy based on the RSI: if it is below a given threshold (i.e. 35) I would enter a long position. However when I test it with the strategy builder, it does not work. Here is the piece of code that I think is the problem:
    HTML Code:
    // Condition set 1
    if (RSI(14, 3).Avg[1] <= 35)
    {
    EnterLong(DefaultQuantity, "");
    }
    Do you see where is the issue?

    Thank you,

    Manuel

    #2
    Hello Manuel,

    I do not see anything wrong with the condition.Could you clarify what is not working?
    JCNinjaTrader Customer Service

    Comment


      #3
      Originally posted by Manuel17 View Post
      Hello,

      I would like to test a simple strategy based on the RSI: if it is below a given threshold (i.e. 35) I would enter a long position. However when I test it with the strategy builder, it does not work. Here is the piece of code that I think is the problem:
      HTML Code:
      // Condition set 1
      if (RSI(14, 3).Avg[1] <= 35)
      {
      EnterLong(DefaultQuantity, "");
      }
      Do you see where is the issue?

      Thank you,

      Manuel
      You are trying to read one bar back. To do so you have to escape the first bar. That means the you have to unlock your strategy and add code to it. Add this line, as the first line in OnBarUpdate().
      Code:
      if (CurrentBar < 1) return;
      Search the forum for that as a phrase, and you will see why you need it.
      Last edited by koganam; 07-21-2013, 03:54 PM. Reason: Corrected spelling.

      Comment


        #4
        Thanks to both of you. I think that my I did something wrong with my strategy builder, just tried again now and it is working perfectly...

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        144 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        71 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X