However, once I added this set to my strategy, it stops working and the other sets don't work anymore.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Can't set daily profit
Collapse
X
-
Can't set daily profit
I am trying to set a daily profit, after that stop trading; for that, I created a boolean "ContinueTrading", set it to true by default, once the daily profit reached, I set it to false.
However, once I added this set to my strategy, it stops working and the other sets don't work anymore.
Tags: None
-
Hello Harry,
Thanks for your post.
The RealizedPNL provided in the strategy builder is not a daily value, it is an accumulated value over the course of the strategy which means the historical trades made by the strategy. So if you apply the strategy to a 5-day chart then trades made over the 5 historical days are added to the realizedPNL. If you look at your chart with the strategy applied you will likely find historical trades on the first day(s) that stop when your condition has been met and then of course no further trading can occur.
It is possible to create a daily resettable PNL in the strategy builder but it is a bit elaborate. I've posted an example and explanation here: https://ninjatrader.com/support/foru...et#post1156861
Alternatively, if you want to start and stop your strategy every day and do not need historical trades, an easy workaround would be to add the condition Misc>CurrentState, Equals, Misc>State>Real time, to each set. This will prevent the strategy from performing historical trades and it will immediately be ready to place live trades and RealizedPNL will start at 0. Note that with this condition you cannot run the strategy in the strategy analyzer but you can test using PlayBack with market replay data.
Paul H.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, Today, 12:45 PM
|
2 responses
16 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
15 responses
3,272 views
0 likes
|
Last Post Today, 03:15 PM | ||
Started by Tim-c, Today, 02:10 PM
|
1 response
8 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
2 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
4 responses
51 views
0 likes
|
Last Post
by chbruno
Today, 02:38 PM
|
Comment