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 argusthome, 03-08-2026, 10:06 AM
        0 responses
        65 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        41 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        23 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        26 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        52 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X