Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't set daily profit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Click image for larger version

Name:	Screen Shot 2021-06-11 at 13.26.31.jpg
Views:	146
Size:	65.4 KB
ID:	1159648
    Attached Files

    #2
    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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X