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 judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        53 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        33 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        5 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        19 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        6 views
        0 likes
        Last Post cre8able  
        Working...
        X