Thank you very much for any specifics you can send along.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
referencing exitprice in strategy
Collapse
X
-
hilfreq, you can work with the TradeClass for this - http://www.ninjatrader-support.com/H...radeClass.html
-
exitprice?
Truth is....when I look at the tradeclass, I don't see clearly how this ties back to the exitprice specifically, and how I can call that variable in my code. I would like to use the exitprice as a reference, for example, to re-enter a trade.
Again, I feel confident that since the exitprice is captured and displayed on the performance table, it must be available as a specific value to use in the code.
If you could help me tie these two pieces together a little more explicitly, I would be most grateful.
Thanks again!!
Comment
-
You can try something like this after your entry / exit triggers -
Code:if (Performance.RealtimeTrades.Count > 0) { Trade lastTrade = [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Performance.RealtimeTrades[Performance.RealtimeTrades.Count - [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]]; [/SIZE][/FONT][/SIZE][/FONT] double lastExit = lastTrade.Exit.Price; Print("The last trade's exit is " + lastExit); }Last edited by NinjaTrader_Bertrand; 11-06-2009, 01:57 PM.
Comment
-
Bertrand,
Thank you for this snippet.
Wouldn't [0] mean the first trade of the session? Shouldn't it be count-1?
Thanks,
Originally posted by NinjaTrader_Bertrand View PostYou can try something like this after your entry / exit triggers -
Code:if (Performance.RealtimeTrades.Count > 0) { Trade lastTrade = Performance.RealtimeTrades[0]; double lastExit = lastTrade.Exit.Price; Print("The last trade's exit is " + lastExit); }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
256 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
165 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
170 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
252 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
203 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment