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 argusthome, Yesterday, 10:06 AM
        0 responses
        14 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        11 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        9 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        4 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        31 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X