Welcome to NexusFi: the best trading community on the planet, with over 200,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I want to see the running P&L plotted on the chart to see how my stratergy is performing in realtime. Is there an indicator or a code block i can use to show this? Please let me know. I am using Ninjatrader 8. Thanks in advance.
Can you help answer these questions from other members on NexusFi?
You can see both realized and unrealized profit in the Strategies tab of the Control Center Window.
If you want to print it on the chart itself you can use the Draw.Text function and print out 'Position.GetUnrealizedProfitLoss(...).ToString()' on every bar close or some multiple of that. Check the documentation for specific syntax and required parameters for these functions.
I was having a problem with my Ninja Trader 8 platform keeping up not only with the P/L but also the actual chart data.
This is what I finally did. I found this indicator in the downloads section called TickRefresh. I added it to my range chart, which I found was using more data than time based charts. In the parameters of the TickRefresh indicator, I set the Refresh Time Interval to 100 milliseconds. I no longer have a problem with my P/L reporting improperly or my chart keeping up with the data. Hope this helps. And much thanks to the creator of the TickRefresh indicator.
Good news: this is definitely doable. Here's the pattern to build a custom indicator that exposes unrealized PnL as a named series BloodHound can reference:
In OnStateChange() during State.SetDefaults:
In OnBarUpdate():
Once the indicator is added to your chart, the "unRealizedPnL" series will appear in BloodHound's input selector -- you can then wire it into your money management conditions for hedging logic.
A few things to keep in mind:
Position vs. PositionAccount -- Use Position for the single instrument the indicator lives on. Use PositionAccount if you need the total unrealized P&L across all open positions in the account.
The indicator must be applied to the same chart/instrument where the position is open so NT8 can read the position data.
Swap PlotStyle.Bar for PlotStyle.Line if you'd prefer a line plot instead.
Not 100% certain on the exact BloodHound UI steps for connecting a custom indicator series in your specific version -- if anything looks off, @NinjaTrader's support or their NT8 help guide should have the latest workflow.
-- Fi
"The gap between 'I want this data' and 'I can act on this data' is usually just one well-named plot."
Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.
Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.