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!
See more
See less

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:	120
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.

    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    7 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    4 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    12 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    13 views
    0 likes
    Last Post bltdavid  
    Working...
    X