Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
daily loss limit in strategy builder
Collapse
X
-
Hello 37s29nala,
Thank you for your post.
Here's an example script a former colleague of ours created that should help. It's a little tricky to do this in the Strategy Builder, but you can if you use a custom series to track the current Strategy PnL. I'd advise importing this and then opening a new Strategy Builder window. On the first screen, find "DailyLossLimitBuilderExample" in the list and from there you can use the Builder navigation buttons to view the necessary logic.
Please let us know if we may be of further assistance to you.Attached FilesKate W.NinjaTrader Customer Service
-
Hello 37s29nala,
Thank you for your reply.
It should not be copied and pasted, it should be imported into NinjaTrader and then you can open a new Strategy Builder window, select "DailyLossLimitBuilderExample" from the dropdown on the first page, and then you can use the navigation buttons to view how the logic is set up.
Note — To import NinjaScripts you will need the original .zip file.
To Import:- Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
- From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
- Select the downloaded .zip file
- NinjaTrader will then confirm if the import has been successful.
Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'
Once installed, you may add the strategy to a chart to test with the Sim101 account by:- Right-click your chart > Strategies... > Select the Strategy from the 'Available' list on the left > Add > Check the Enable checkbox on the right > OK
Kate W.NinjaTrader Customer Service
Comment
-
Hey Kate,
Jumping in here.
I ran this strategy by itself through the strategy analyzer to verify that it worked. One of the things that I noticed was that the Net Profit column in the strategy analyzer was still showing days that had -$7,000 or more, while the daily loss was set at -100. That doesn't make sense. Shouldn't the daily loss prevent a net loss greater than -$100?
Is there some setting in the Strategy Analyzer that I am missing, or is there something that I am missing in the process? I am just trying to stop the strategy from losing a lot of money on it's bad days. Please help!Last edited by 102531911197541600524:NTB; 05-26-2024, 03:05 PM.
Comment
-
Hello,
Thank you for your post.
The actual PnL of the strategy does not have to match the amount for the DailyLoss you have set in code - this is is just the limit to prevent the following trade.
As an example, if you enter and it goes bad and the PnL of that trade is -300 when it's closed, then the next trade won't be submitted because it is past the limit. However, the actual PnL is -300 which is what the Analyzer is reporting.
If you take a look at the output of the script, you can see once your DailyLoss has been hit no further trades are taken until the next trading day.
If you want the analyzer to only show losses of 100, you would need to add additional code to check the unrealized PnL while in a trade and check if it is past -100, then close the trade.
Please let us know if you have any further questions.Gaby V.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Kate View PostHello 37s29nala,
Thank you for your reply.
It should not be copied and pasted, it should be imported into NinjaTrader and then you can open a new Strategy Builder window, select "DailyLossLimitBuilderExample" from the dropdown on the first page, and then you can use the navigation buttons to view how the logic is set up.
Note — To import NinjaScripts you will need the original .zip file.
To Import:- Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
- From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
- Select the downloaded .zip file
- NinjaTrader will then confirm if the import has been successful.
Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'
Once installed, you may add the strategy to a chart to test with the Sim101 account by:- Right-click your chart > Strategies... > Select the Strategy from the 'Available' list on the left > Add > Check the Enable checkbox on the right > OK
Well I accidentally pressed yes. is there any way to revert back?
Comment
-
Hello,
There is no way to revert back - you may need to do a clean install to restore them to the default versions. However, if you simply installed the script posted by Kate then there is nothing to worry about as the script she posted did not change any of these default scripts.Gaby V.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Gaby View PostHello,
There is no way to revert back - you may need to do a clean install to restore them to the default versions. However, if you simply installed the script posted by Kate then there is nothing to worry about as the script she posted did not change any of these default scripts.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by lorien, 08-08-2021, 07:33 AM
|
10 responses
711 views
0 likes
|
Last Post
by AndyM871
Today, 05:25 PM
|
||
Started by henann, Today, 04:47 PM
|
0 responses
2 views
0 likes
|
Last Post
by henann
Today, 04:47 PM
|
||
Started by zstheorist, 11-23-2024, 09:06 AM
|
3 responses
19 views
0 likes
|
Last Post Today, 04:06 PM | ||
Started by Ousher, 02-07-2022, 07:37 PM
|
6 responses
456 views
0 likes
|
Last Post
by nelslynn
Today, 03:53 PM
|
||
Started by connorgrant5, Today, 03:04 PM
|
1 response
6 views
0 likes
|
Last Post Today, 03:37 PM |
Comment