I also noted that trailing stop doesn't work into strategy during backtest
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
strategy building with conditions on multiple timeframes
Collapse
X
-
Hello hellboy78,
Trailing does work in a backtest however its modified based on the OnBarUpdate events. because OnBarClose processing is always used in a backtest the trailing would only be able to be moved once per bar. To test this concept fully you would need to use the Playback connection so you can see the OnEachTick trailing happening.
It is possible to update a Trailing stop tick by tick in a backtest but that would require manually coding the script. A 1 tick secondary series can be used and then the target can be resubmitted on that 1 tick series, that would allow it to be updated intrabar similar to realtime.
Comment
-
Hello hellboy78,
You can remove the Variables you added, you are using the User Inputs for your targets. You need to specify the defaults in the user input section and not the variables section.
Also keep in mind The SetTrailStop cannot be used with the SetStopLoss, you can use one or the other.
Comment
-
Hello hellboy78,
Did you make sure the user inputs have the correct values while applying it? What you pictured are the defaults in the script but could be something else if you changed it while applying it. If you previously saved a default template those values would be used instead. I otherwise wouldn't be able to tell what may have happened based on those screenshots.
Comment
-
Hello hellboy78,
From the images I wouldn't be able to tell what may be happening aside from the trail stop should not be working. I would suggest trying to remove the trail stop so you just have a stop and target and then recompile and re test. When are re testing make sure that you don't just F5 reload or disable/re enable the strategy, you need to remove it and re apply it to see changes with user inputs or the stops and targets page.
Comment
-
it works. thanks. I don't really think the auto trade is the way.
maybe to draw some diamonds and arrows, yes.
how to, for a particular condition, draw a diamond, for example, but into a separated panel
for example
diamonds of 60min condition, at the bottom, diamonds of 15 min condition on second line, 5min diamonds on first line at the top
Comment
-
Hello hellboy78,
The drawing objects by default are in the price panel. If you run the strategy in a sub panel the objects could be drawn then by using DrawOnPricePanel = false.
https://ninjatrader.com/support/help...sub=pricepanel
it sounds like you may need to make an indicator for the use case you described, the indicator could be applied to a sub panel to mark that panel while the strategy is still in the primary panel.
Comment
-
Hello hellboy78,
Right you would need to make that in the NinjaScript editor. The builder can add indicators in conditions and then use the Plot on chart option to show it. In this use case if you just wanted an indicator for display purposes you can make a new set and a condition to use the indictor in some way even if that condition does not make sense. As long as you call the indicator and choose plot on chart you can have the indicator added and use its own logic.
You can generate the conditions you want in the builder and click View Code then copy that generated code for the conditions/drawing to the indictor if you dont want to manually code it.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, 03-13-2026, 05:17 AM
|
0 responses
86 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
151 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
79 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
52 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
59 views
0 likes
|
Last Post
|

Comment