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 charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
55 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
142 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
160 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
96 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
276 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment