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

Rule A is True then generate arrown When rule B become true

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

    Rule A is True then generate arrown When rule B become true

    Hi,

    I want string for strateg wizard that When Strategy wizard Tab1 Set of Rules are true on one bar than keep Tab1 true for next 10 bars.


    awaiting

    #2
    You will need to unlock your code to do this. When Set 1 is true as an action tell it to set a variable to 0. As each new bar progresses increment the variable. When the variable is greater than you wanted then invalidate your condition at that point in time.

    Code:
    // Set 1
    if (Close[0] > Open[0])
    {
         variable = true;
    }
    
    if (variable == true)
    {
         counter++;
    }
    
    if (counter == 10)
    {
         variable = false;
    }
    
    // Set 2
    if (High[0] > High[1] && variable == true)
    {
         // Do something;
    }
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you josh, is there any way i can do this in Strategy wizard? I have very less experience in script language.

      Also can you suggest me where i can read how to do script strategy writing.

      awaiting

      Comment


        #4
        You would need to unlock the code to do it. Best place to start is the Help Guide tutorials. Then you can create yourself some strategies with the Wizard and unlock them to see the code.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Josh

          Have a great week end

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by helpwanted, Today, 03:06 AM
          1 response
          12 views
          0 likes
          Last Post sarafuenonly123  
          Started by Brevo, Today, 01:45 AM
          0 responses
          9 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          5 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          242 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          387 views
          1 like
          Last Post Gavini
          by Gavini
           
          Working...
          X