Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Is it possible to see profit/loss in the chart?
Collapse
X
-
Is it possible to see profit/loss in the chart?
I trade with an automated strategy And I want to see the profit loss in the chart when the trade is closed is this possible?Tags: None
-
Is it possible to see profit/loss in the chart?
Hello MichaelAlexander,
Thanks for writing in to our Support team.
You would need to create a variable to hold the information for your last trade and convert the double value to a string to provide as an argument to the Draw.Text() method. You will need to utilize the Trade and TradeCollection objects to achieve this. Here is a short code sample for your reference:
Code:protected override void OnBarUpdate() { if (SystemPerformance.RealTimeTrades.Count > 0) { // this line will assign the most recent trade to the lastTrade object Trade lastTrade = SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count -1]; // this line will convert the last trade's profit quoted in currency to a string string lastProfitCurrency = lastTrade.ProfitCurrency.ToString(); // this line will draw the last trade's profit quoted in currency on your chart Draw.Text(this, "Profit of last trade", lastProfitCurrency, 10, 1000, Brushes.Black); } }
http://ninjatrader.com/support/helpG...n-us/trade.htm
For more information on the TradeCollection data structure, you can visit our help guide here:
http://ninjatrader.com/support/helpG...collection.htm
For more information on the Draw.Text() method, you can visit our help guide here:
http://ninjatrader.com/support/helpG.../draw_text.htm
Please let me know if I may be of any further assistance.Alan S.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by andrewtrades, Today, 04:57 PM
|
1 response
8 views
0 likes
|
Last Post Today, 05:02 PM | ||
Started by chbruno, Today, 04:10 PM
|
0 responses
6 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
436 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
7 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
19 views
0 likes
|
Last Post Today, 03:33 PM |
Comment