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

Strategy executing on every bar

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

    Strategy executing on every bar

    I am in need of help. I have a strategy that i use an indicator with. I used the builder and put in if price high/low goes 1 tick beyond indicator to execute a long/short position for a 1 point scalp.
    It will execute a position on every bar above/below the indicator. Is there a way i can get it to execute once until indicator is reset or waits a certain number of bars?

    Thanks

    #2
    Hello kdaugherty1987,

    Thanks for your post and welcome to the NinjaTrader forums!

    In the Strategy Builder you can create a bool variable (on the Inputs and Variables page), and as part of the entry conditions check that the bool variable is true and then in the "do the following" section of that set, set the bool to be false. This will prevent that set from placing any further orders until the bool is reset to true and the entry condition is true again. You can then create another set that you would use to set the bool back to true based on your preferred reset condition.

    Reference: https://ninjatrader.com/support/help...ariablesScreen
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello kdaugherty1987,

      Thanks for your post and welcome to the NinjaTrader forums!

      In the Strategy Builder you can create a bool variable (on the Inputs and Variables page), and as part of the entry conditions check that the bool variable is true and then in the "do the following" section of that set, set the bool to be false. This will prevent that set from placing any further orders until the bool is reset to true and the entry condition is true again. You can then create another set that you would use to set the bool back to true based on your preferred reset condition.

      Reference: https://ninjatrader.com/support/help...ariablesScreen
      Hi Paul,

      I am trying to follow your instructions here with setting up a bool variable because I have the same problem. However, in the "Do the following" area, it won't let me choose any variables. It only lists Drawing, Misc, and Order Management as options. I am able to put it in the conditions area though. Any thoughts on how to help would be greatly appreciated. Thanks-

      Maria

      Comment


        #4
        Hello marialewis16,

        Thanks for your post.

        For the bool variable to be able to be changed by the strategy, you need to make sure you create it as a variable and not as an Input.

        To be able to set the bool variable to a different state, you can only do that in a "do the following" (also referred to as the action) section of a set.

        I've attached two screenshots, the larger one shows a bool variable named "Test" created in the variables section of the input and variables window.

        Click image for larger version

Name:	marialwis16-1.PNG
Views:	262
Size:	22.1 KB
ID:	1148234

        In the smaller screenshot, this is from the "do the following" section of a set where you can see the action is to "Set Test"

        Click image for larger version

Name:	marialwis16-2.PNG
Views:	270
Size:	10.0 KB
ID:	1148235

        References:



        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        5 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        7 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X