Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Two strategies connected
Collapse
X
-
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?Tags: None
-
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:
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.Code:if (xOverCondition && notYetTraded) { EnterLong(); notYetTraded = 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
-
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
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
379 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
111 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
577 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
582 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment