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

BarsSinceExitExecution() and ChangeOrder()

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

    BarsSinceExitExecution() and ChangeOrder()

    Hello

    In managed order approach, I use ChangeOrder() to modify stop two tick above long entry price with several conditions.

    How can I use BarsSinceExitExecution() n bars from initial stop but not in case BE+2. Is it possible change signal name? If not, how could be done?

    Thanks

    #2
    Hello Impeesa,

    Thanks for your post.

    If I understand correctly you have an entry with an initial stop. If this trade progresses and you have certain conditions met, you change the stop to BE+2. You are asking about how to create a next entry condition using BarsSinceExitExecution() but only if it hits your initial stop?

    If I have understood correctly, the answer here would be to create a bool variable that you set when you do the change order. You can use the state bool then to allow or prevent using BarsSinceEntryExecution(). A generic example:

    if (BarsSinceEntryExecution() >= 5 && myBool == true && your other entry conditions)
    {
    // do something
    myBool = false; // reset the bool
    }


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello, Paul

      You are ok. I want to create a next entry condition using BarsSinceExitExecution() but only if it hits your initial stop.

      But in generic example provided, you use BarsSinceEntryExecution().

      I can not see how use a bool for my initial purpose...

      Comment


        #4
        Hello Impeesa,

        Thanks for your reply.

        Correct, I made a mistake using BarsSinceEntryExecution and meant to write that as BarsSinceExitExecution.

        When your code executes the change order, that is where you would set a bool variable that would be used to prevent the entry that uses BarsSinceExitExecution.

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        191 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,229 views
        0 likes
        Last Post xiinteractive  
        Started by andrewtrades, Today, 04:57 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        7 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        441 views
        0 likes
        Last Post Delerium  
        Working...
        X