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

on bar update in strategy builder

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

    on bar update in strategy builder

    I am creating a new strategy and have On Bar Update set. The strategy is using three different time frames set in "Additional Data" on an Instrument.

    The strategy now fires off an alert when certain conditions are met, great but I am trying to test out now for an order entry. The problem arises when every new bar when conditions are met would keep firing off order entries on bar update.
    I want only one order entry and to ignore further triggering of the condition until another condition would prevail and exit the market.

    As it is The strategy would keep making entries every time a new bar was to form on the three time frames when conditions are met, I just want the first order to trigger entry until a second condition was met to exit the market.

    Grateful for any help here, as I am finding my way around the Strategy builder.

    Thanks in advance and hope I have made myself clear!

    #2
    I am thinking I need a 4th Condition ?

    Strategy Builder/Conditions and actions.

    I have three conditions at present and that is the three time frames that trigger the conditions by the "If All " the following conditions are met.

    Indicator, instrument time frame and condition x in 3 time frames.

    So this triggers everytime the three conditions are met. I am trying to make it trigger just once when the three conditions are met.

    4th condition would be if triggered once don't trigger again ?

    Comment


      #3
      Hello fredfred123,

      Thanks for your post.

      You can add a bool variable (create this in the Inputs and Variables strategy builder window) that is set true initially (default setting). Add the check that the bool is true when all three conditions are true. In the actions section then you have your entry action and set the bool variable to false to prevent further orders.

      You will need another set that resets the bool back to true so that it will allow entry again when you choose.
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Hi Paul

        Thank you so much, I've set that up and made another set to return the bool to true and testing it now!

        Truly fantastic and saved the rest of my hair!!

        Many thanks

        Comment


          #5
          works perfectly thank you so much !

          Comment


            #6
            One question?

            When I start the strategy up the Bool Variable will be at the default of True.
            when a trade is triggered the Bool is set to False.

            When the Trade is cancelled by the strategy the Bool Variable is reset to true so another trade is possible.

            If I interrupt and manually exit the trade The Bool variable would still be at False as the strategy had not canceled the trade and not reset the Bool variable.

            If I disable and re enable the strategy would that reset the Bool variable to True as it is the default condition?

            Many thanks

            Comment


              #7
              Hello fredfred123,

              Thanks for your reply.

              Correct, when you re-enable the strategy the bool will be set to true.
              Paul H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by maybeimnotrader, Yesterday, 05:46 PM
              1 response
              18 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Perr0Grande, Yesterday, 08:16 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by f.saeidi, Yesterday, 08:12 AM
              3 responses
              24 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by algospoke, Yesterday, 06:40 PM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by quantismo, Yesterday, 05:13 PM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X