I'm trying to setup a strategy to wait for a macd cross and price to close past 2 sma lines. Can they be setup in the same set in strategy builder or does it need to be 2 sets, and do they have to be in any certain order? Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy uses 2 conditions
Collapse
X
-
Strategy uses 2 conditions
Hi,
I'm trying to setup a strategy to wait for a macd cross and price to close past 2 sma lines. Can they be setup in the same set in strategy builder or does it need to be 2 sets, and do they have to be in any certain order? ThanksTags: None
-
Hello Clevchin,
If both of of those conditions need to be together, for example the macd cross AND close past 2 sma lines then that would go in a single set. Each set is evaluated independently so anything that should go together generally is in one set and anything that needs to operate separately would go in multiple sets.
-
Hello Clevchin,
You can attach a screenshot and we can go over what that code would be doing. To really know if it works right you will still need to test the strategy and make sure that is the result you wanted. You can test the strategy on the sim account or a demo account while developing the strategy to make sure its working as you wish.
Comment
-
It does enter when I think from what I can tell. Does the builder go in order like in the sets it has the macd cross first and is that how that orders look to get placed? The mac d crossed and then price corsses the ema and thats when the order gets placed? Also how close does it have to be together for it to take the trade from what the screen shots show. Sometimes it looks like it should enter but I think the price crossing it to far away.
.
Comment
-
Hello Clevchin,
The sets in the builder do go in order, so set 1 will be checked before set 2 and so on. The conditions inside each set also go in order however those are controlled by the dropdown list at the top of the set that says if Any or if All. Depending on that setting the set could work in two different ways. If you are using if All that requires all the conditions in the set to be true at the same time. If you use if any that means if any one of the conditions in the set is true the whole set is true.
For what you are describing the macd would need to cross in the same event as the price crossing the ema. If they are becoming true on different bars then that set won't be true.
The question here would be are you trying to submit an order when both the macd and ema conditions are true at the exact same time or were you trying to do something where if the macd condition is true that enables a second set to check for a later time when the ema cross condition becomes true?
Comment
-
Hello Clevchin,
As long as those two conditions are in the same set then it would require them to happen in the same candle. To do anything else like the candle after would require using multiple sets and a variable. You would essentially just use the macd set to toggle a variable to true and then in a second set check if the variable is true and also if the ema crossed over, if so submit the order. That variable would need to be reset also when you submit the order so it can repeat that process again later.
Comment
-
Here's what I put together so far. I added to variables. one for if macd crosses up and one if macd crosses down. Both are set for true. I also broke up the sets. How far off am I and I also wasn't sure how to get it to reset after triggering it. Thanks
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
30 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment