Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Two strategies connected

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

    Two strategies connected

    Basically , I want to have a simple strategy that acivates on the open of the market if it is a certain distance from a moving average than after that trade revert back to a second strategy for the rest of the day. Is this possible to automate so I dont have to manually turn off and turn on each strategy?

    #2
    Hello DinoSchu,

    Thank you for your post.

    Yes, this is possible with custom programming. You would set a bool flag along with your initial entry.

    You would check the state of this bool flag for your first entry. Here's some brief pseudo code:

    Code:
     
    if (xOverCondition && notYetTraded)
    {
    EnterLong();
    notYetTraded = false;
    }
    If you only want to trade the other entries once the initial Xover has taken place, then you'd just check that the state of this variable is false.

    The reference sample below goes over resetting these types of values at the beginning of a trading day.

    Resetting values at the beginning of new trading sessions.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you , Can I just add this intial trade and the bool to the coding in the secondary system . And if so does the trade go under the ONBarUpdate or in the Intializing section

      Comment


        #4
        Hello Dino,

        There is no communication between different strategies. The idea here is that your rules are part of one system. The bool flags are used to structure the sequence of events that you'd like to follow. This logic belongs in the OnBarUpdate() method.

        Here's a more human approach to this idea:

        I'll eat my vegetables when it's 6 o clock.
        I only want to eat vegetables once per day.
        I want to eat dessert only after I've eaten my vegetables.
        I only eat dessert when it's really good.


        Code:
         
        //Rule 1
        if (6:00 PM && notHadAnySprouts)
        {
        eatSomeSprouts;
        notHadAnySprouts = false;
        }
         
        //Rule 2
        if(notHadAnySprouts == false && cakeIsGreat)
        eatSomeChocolateCake;
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        673 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        577 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X