I'm new to programming in general and I'm a boomer so please cut me some slack. I've been doing this for only 3 weeks so I know just enough to be dangerous. Please see the attached image of the strategy I'm attempting to set up. It looks to me like I described the candles and their relationship to each other that would be considered a bullish engulfing pattern. However, when I run it live (in simulator cause I'm not crazy), it fires off orders in seemingly random order. Can anyone help me to see the light?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Engulfing Bullish Candle
Collapse
X
-
Engulfing Bullish Candle
Hi,
I'm new to programming in general and I'm a boomer so please cut me some slack. I've been doing this for only 3 weeks so I know just enough to be dangerous. Please see the attached image of the strategy I'm attempting to set up. It looks to me like I described the candles and their relationship to each other that would be considered a bullish engulfing pattern. However, when I run it live (in simulator cause I'm not crazy), it fires off orders in seemingly random order. Can anyone help me to see the light?1 PhotoTags: None
-
Hello ARobotPolisher,
May I have you write out the exact rules you consider a bullish engulfing pattern?
I can help check that your logic is what you've entered into the condition.
There is also the CandleStickPattern indicator which has a bullish engulfing selection.
If you are wanting to understand why the conditions are evaluating as true, add prints. to a new condition set without any conditions. that print the date time of the bar and all values compared in every condition that places an order.
In the Strategy Builder prints are added in the Actions ('Do the following') window in the Misc section.
Below is a link to the 'Debugging with the Strategy Builder' video which demonstrates.
The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.
The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.
Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).
Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.
After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.
I am happy to assist you with analyzing the output from the output window.
Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.
Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.
Let me know the date and time the behavior occurred or when you are expecting the behavior to occur.Chelsea B.NinjaTrader Customer Service
- Likes 1
-
Thanks Chelsea,
Attached is the code on the indicator link instructions:
ChartPattern.BullishEngulfing: found = isInDownTrend && n.Close[1] < n.Open[1] && n.Close[0] > n.Open[0] && n.Close[0] > n.Open[1] && n.Open[0] < n.Close[1]; break;
My Instructions: Close[1] < Open [1] && Close [0] > Open [0] && Close [1] == Open [0] && Open[1] < Close[0]
I'll change mine to this and see what happens. Also, is there a way to put "isinDownTrend" in the strategy builder?
Comment
-
Hello ARobotPolisher,
The isinDownTrend would be too complex for the Strategy Builder.
This is using logic that depends on loops which are not possible in the Strategy Builder. See lines 425 to 471 for the logic that sets this value.
You can use the CandleStickPattern indicator in the Strategy Builder. When the plot value is equal to 1, the selected pattern was found.
Chelsea B.NinjaTrader Customer Service
Comment
-
Thanks Chelsea, It's weird. The bullish and bearish engulfing data from the indicator coding works ok but not yielding the results I desired. So, I guess I'm not going to be a millionaire anytime soon. The one feature I CANNOT seem to get to work is that I want the price of the close in candle [1] to equal the price of the open in candle [0]. That seems to be possible and logical but I add that and my backtesting yields zero results. If I mirror the candle pattern default it works and if I add anything it's not working. I haven't had time to watch the videos or do a lot of research so I will go carefully down that route to see if there's something I missed. Thanks a lot for your help!!
Comment
-
Hello ARobotPolisher,
"the price of the close in candle [1] to equal the price of the open in candle [0]"
On the left select Price > Close and set Bars ago to 1, in the center select Equals, on the right select Price > Open (leave Bars ago set to 0).
To understand why the behavior is not as you expect on the date and time of the bar you expect, print the time of the bar and ALL values compared in the condition to the output window with labels for each value and comparison operator.
Attached the output text file to your next post.
Let me know the date and time to review in the output.
I would be happy to assist with analyzing the output to understand behavior.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
52 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
130 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
44 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
48 views
0 likes
|
Last Post
|

Comment