Anyone have an example of this for builder
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
BOOL example needed
Collapse
X
-
BOOL example needed
I have a condition that's fairly simple yet. For some reason, I can't get it to work in the strategy builder. I have a breakout that takes an entry once price closes above a level. Instead of entering on the breakout candle I want the next candle to be green before entry is made. Thus we have 2 conditions that need to be satisfied prior to entry.
Anyone have an example of this for builderTags: None
-
Hello Teebone21,
Thank you for your post.
First, are you wanting to wanting to enter on the bar right after the cross above happens? Or, do you want the strategy to wait until after the close of the bar it happened on to make sure that bar is green (which would mean entering on two bars after the crossover)?
If so, you may need to use a bool if you are using CrossAbove().
One set would check if CrossAbove is true, then set your bool to true.
The next set will check if the bool is true, and if the Close is less than the Open (meaning a red bar) and set the bool to false so it will not enter / continue onto the next set.
The last set will check if the bool is true, and if the Close is greater then the Open (a green bar) and if so you can add an action to enter.
I have added a sample script you can look at demonstrating this (it uses Calculate.OnBarClose).
Please note this also depends if you are calculating OnBarClose or OnEachTick/OnPriceChange. Calculating OnEachTick/OnPriceChange will cause OnBarUpdate to update on the "current forming bar" instead of the previously formed bar.
Calculate - https://ninjatrader.com/support/help.../calculate.htm
Attached Files
-
Thank you for the reply. I would like to enter 2 bars after the cross over. But the second bar after the crossover has to close green Is in order for the buy condition to happen on Open of 3rd barOriginally posted by NinjaTrader_Gaby View PostHello Teebone21,
Thank you for your post.
First, are you wanting to wanting to enter on the bar right after the cross above happens? Or, do you want the strategy to wait until after the close of the bar it happened on to make sure that bar is green (which would mean entering on two bars after the crossover)?
If so, you may need to use a bool if you are using CrossAbove().
One set would check if CrossAbove is true, then set your bool to true.
The next set will check if the bool is true, and if the Close is less than the Open (meaning a red bar) and set the bool to false so it will not enter / continue onto the next set.
The last set will check if the bool is true, and if the Close is greater then the Open (a green bar) and if so you can add an action to enter.
I have added a sample script you can look at demonstrating this (it uses Calculate.OnBarClose).
Please note this also depends if you are calculating OnBarClose or OnEachTick/OnPriceChange. Calculating OnEachTick/OnPriceChange will cause OnBarUpdate to update on the "current forming bar" instead of the previously formed bar.
Calculate - https://ninjatrader.com/support/help.../calculate.htm
Comment
-
Thanks for the example. What you provided only enters after the close as normal. I tried added 2 bool conditions and still no luck. It seems like it should be simple but it doesnt work for some reason.Originally posted by NinjaTrader_Gaby View PostHello,
In that case, you can set it up as described in my previous reply with the bool.
Please let us know if you have any other questions.
Comment
-
Hello,
Since you need the to track if the bools are triggering on specific bars and not any bars, it may be better to put this in one condition:
if (Close[0] > Open[0] && Close[2] < MyPriceLevel && Close[1] > MyPriceLevel)
Please see this forum post which has an example script:
https://forum.ninjatrader.com/forum/...ly#post1131172
If you have any questions, please let me know
- Likes 1
Comment
-
i was unable to complete my project after multiple attempts. I figured a simple bool could solve the issues or just using candle close comparison. I may just pay someone to recreate this. Thank you for your assistanceOriginally posted by NinjaTrader_Gaby View PostHello,
Since you need the to track if the bools are triggering on specific bars and not any bars, it may be better to put this in one condition:
if (Close[0] > Open[0] && Close[2] < MyPriceLevel && Close[1] > MyPriceLevel)
Please see this forum post which has an example script:
https://forum.ninjatrader.com/forum/...ly#post1131172
If you have any questions, please let me know
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
50 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 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