Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to export all Trades from Strategy Analyzer
Collapse
X
-
How to export all Trades from Strategy Analyzer
After the Execution of Back Test I want to export all the cumulative Trades into excel how can I do that ?Tags: None
-
Eric the above method you suggested will only export the trades for the selected Instrument only. My simulation is across the Instrument List and I want to export all Trades across all Instruments in the Simulation.
So I adopted the following . The problem is Time[CurrentBar] is always returning me second day from the start of simulation. Is there a way for me to get the TimeStamp of CurrentBar, so I can compare that with Current time and print all cumulative trades from SystemPerformance
// Print out Simulation Results to Output Window at the end of Simulation
if (DateTime.Now.Subtract(Time[CurrentBar]).Days<1 && this.SimulationMode)
{
for(int i=0; i<SystemPerformance.AllTrades.Count; i++)
{
Trade lastTrade = SystemPerformance.AllTrades[i];
NinjaTrader.Code.Output.Process(Account.Name+" - "+Instrument.FullName + " - " + (lastTrade.Entry.MarketPosition.Equals(MarketPosit ion.Long)?"BUY":"SELL")+" - "+ lastTrade.Entry.Name+" - "+lastTrade.Entry.Time + " - " + lastTrade.Exit.Time+" - "+lastTrade.Exit.Price + " - " +lastTrade.Entry.Price, PrintTo.OutputTab1 );
}
Comment
-
Hello vivekniwas,
Thank you for the post.
The DateTime.Now would hold no relation toward historical data so I would not suggest using this in your development. This would also hold no relation to any of the times the platform uses, this is specifically your PC clock time.
To find the time of the current bar, you would use Time[0]. CurrentBar represents the index of the bar being processed, Time[0] represents the time for that bar, zero bars ago from the CurrentBar.
Using Time[CurrentBar] you are saying "get the time of the bar using CurrentBar as the BarsAgo ago". Assuming you were on CurrentBar 1000, that would be 1000 BarsAgo from now. This would be the beginning of the chart.
When processing you will always use the BarsAgo inside the brackets like Time[BarsAgo] for the bar you want to reference. if you want the time of now or the currently processing bar you will always use 0 BarsAgo or Time[0].
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rocketman7, Today, 02:12 AM
|
7 responses
28 views
0 likes
|
Last Post Today, 09:23 AM | ||
Started by guillembm, Yesterday, 11:25 AM
|
3 responses
16 views
0 likes
|
Last Post Today, 09:11 AM | ||
Started by junkone, 04-21-2024, 07:17 AM
|
10 responses
148 views
0 likes
|
Last Post Today, 09:03 AM | ||
Started by tsantospinto, 04-12-2024, 07:04 PM
|
6 responses
101 views
0 likes
|
Last Post
by tsantospinto
Today, 08:57 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
7 responses
28 views
0 likes
|
Last Post Today, 07:56 AM |
Comment