Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,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 -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Excel Tradingjournal filled by Ninjatrader
Updated June 14, 2014
Top Posters
looks_one
fossil
with 3 posts (1 thanks)
looks_two
SodyTexas
with 2 posts (2 thanks)
looks_3
DavidHP
with 1 posts (1 thanks)
looks_4
lsandersj
with 1 posts (0 thanks)
Best Posters
looks_one
Big Mike
with 2 thanks per post
looks_two
SodyTexas
with 1 thanks per post
looks_3
DavidHP
with 1 thanks per post
looks_4
fossil
with 0.3 thanks per post
trending_up
2,636 views
thumb_up
6 thanks given
group
4 followers
forum
7 posts
attach_file
0 attachments
Excel Tradingjournal filled by Ninjatrader
June 5th, 2014, 02:00 AM
Germany
Experience: Intermediate
Platform: Ninjatrader
Broker: IB and zen-Fire
Trading: NQ
Posts: 92 since Apr 2010
Thanks Given: 8
Thanks Received: 39
Iīve been searching for hours here but i canīt find an excel tradingjournal filled by Ninjatrader export. Maybe you know one please tell me.
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
June 5th, 2014, 09:02 AM
Bradenton, FL
Posts: 7 since Aug 2013
Thanks Given: 3
Thanks Received: 4
Have you looked at TJS Elite. It has a NJ import.
trading-journal-spreadsheet.com
Tell him Larry sent you/
June 5th, 2014, 12:10 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,534
fossil
Iīve been searching for hours here but i canīt find an excel tradingjournal filled by
Ninjatrader export. Maybe you know one please tell me.
The most popular one on nexusfi.com (formerly BMT ) is this one:
Check end of thread, it's continually developed.
Mike
June 13th, 2014, 11:46 PM
Austin TX
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 421 since Sep 2013
Thanks Given: 117
Thanks Received: 1,085
fossil
Iīve been searching for hours here but i canīt find an excel tradingjournal filled by
Ninjatrader export. Maybe you know one please tell me.
I have one based on Van Tharp's R-multiples, works great on live trading but horrible on market replay. It is based on this code here: Dionysus New Year Present Ninja & Excel - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum
FYI, the reason it does not work in market replay is because excel hangs when to much data is sent to it via a Interop. The solution to this is to build a RTD server, a DDE link or scratch excel for the trade log. I am taking the path of scratching excel as a trade log and building a MySQL database that will act as a trade log. From MySQL I can export the data to excel or use programs suchs as R or Matlab to play with the numbers.
Either way, I hope this code below is a good starting point for ya.
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
//Make sure to references the following dlls
using Excel = Microsoft.Office.Interop.Excel;
using System.IO;
#endregion
//Spreadseet
private string excelFile = @"C:\Users\asoderstrom\Documents\Dropbox\NT7 Trade Log\TradeLogKinkoGC1.xlsm";
private string excelSheetName = "Trade Log";
private bool workSheetFound = false;
private bool excelOpen=false;
private string fullFileName;
private string simpleFileName;
Excel.Application excelApp;
Excel._Workbook excelWorkBook;
Excel._Worksheet excelSheet;
Excel.Range excelRange;
private int temp;
//Export to spreadsheet
private string xlLongShort;
private string xlSymbol;
private DateTime xlEntryTime;
private int xlEntryQty;
private double xlEntryPrice;
private DateTime xlExitTime;
private int xlExitQty;
private double xlExitPrice;
private double xlComission = 6.00;
private double xlPnL;
private double xlRmultiple;
private double xlDollarRisk;
Excel.Range AcctString;
#endregion
#region updateExcel
private void UpdateExcel()
{
excelRange = excelSheet.get_Range("A6","V6");
excelRange.Rows.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftDown,false);
excelSheet.Cells[6,1] = xlLongShort;
excelSheet.Cells[6,2] = Instrument.MasterInstrument.Name;
excelSheet.Cells[6,3] = xlEntryTime.ToString();
excelSheet.Cells[6,4] = "=FLOOR(C6,1)";
excelSheet.Cells[6,5] = xlEntryQty;
excelSheet.Cells[6,6] = xlEntryPrice;
excelSheet.Cells[6,7] = xlExitTime.ToString();
excelSheet.Cells[6,8] = "=FLOOR(G6,1)";
excelSheet.Cells[6,9] = xlExitQty;
excelSheet.Cells[6,10] = xlExitPrice;
excelSheet.Cells[6,11] = "=(G6-C6)*24";
excelSheet.Cells[6,12] = "=I6*Comm";
excelSheet.Cells[6,13] = xlPnL;
excelSheet.Cells[6,14] = xlDollarRisk;
excelSheet.Cells[6,15] = "=X6*Q7";
excelSheet.Cells[6,16] = "=M6/O6";
excelSheet.Cells[6,17] = "=Q7+M6";
excelSheet.Cells[6,18] = "=(Q6-Q7)/Q7";
excelSheet.Cells[6,19] = "=(Q6-bEquity)/bEquity";
excelSheet.Cells[6,20] = "=MAX(Q6:bEquity)";
excelSheet.Cells[6,21] = "=(Q6-T6)/T6";
excelSheet.Cells[6,22] = "=IF(M6>=0,IF(V7<>0,V7+1,1),0)";
excelSheet.Cells[6,23] = "=IF(M6<0,IF(W7<>0,W7+1,1),0)";
excelSheet.Cells[6,24] = EquityAtRisk;
AcctString = (Microsoft.Office.Interop.Excel.Range)excelSheet.Cells[1,11];
EquityAtRisk = (double)AcctString.Value2;
DrawTextFixed("hi","Ear: " + EquityAtRisk,TextPosition.BottomRight);
}
#endregion
#region On Bar Update
protected override void OnBarUpdate()
{
//Excel
if (excelOpen == false) SetUpSpreadsheet();
}
#endregion
#region On Execution
protected override void OnExecution(IExecution execution)
{
//Long Trades ***************************************************************************************
if (enterLong != null && enterLong.Token == execution.Order.Token)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
}
if (execution.Order.OrderState != OrderState.PartFilled)
{
myEntryBar = CurrentBar;
myBarsSinceEntry = 1;
PLong = true;
FToB = true;
if(Close[0] < RiskL[0])
{
exitLong = ExitLong("S2C","B2O");
}
else
{
exitLongStop = ExitLongStop(0, true, execution.Order.Quantity, RiskL[0], "ATR-L", "B2O");
}
intRisk = (execution.Order.AvgFillPrice - MinCloud[0]);
xlLongShort = "Long";
xlEntryTime = execution.Order.Time;
xlEntryQty = execution.Order.Quantity;
xlEntryPrice = execution.Order.AvgFillPrice;
enterLong = null;
}
}
if ((exitLongStop != null && exitLongStop == execution.Order))
{
if (execution.Order.OrderState == OrderState.Filled && execution.Order.OrderState != OrderState.PartFilled)
{
PLong = false;
xlExitTime = execution.Order.Time;
xlExitQty = execution.Order.Quantity;
xlExitPrice = execution.Order.AvgFillPrice;
xlPnL = Math.Round((((xlExitPrice - xlEntryPrice)*xlExitQty)*Instrument.MasterInstrument.PointValue),2);
xlDollarRisk = Math.Round(((intRisk)*Instrument.MasterInstrument.PointValue),2);
xlRmultiple = xlPnL/xlDollarRisk;
UpdateExcel();
exitLongStop = null;
}
if(execution.Order.OrderState == OrderState.Rejected)
{
exitLongStop = null;
}
}
if(exitLong != null && exitLong == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled && execution.Order.OrderState != OrderState.PartFilled)
{
PLong = false;
xlExitTime = execution.Order.Time;
xlExitQty = execution.Order.Quantity;
xlExitPrice = execution.Order.AvgFillPrice;
xlPnL = Math.Round((((xlExitPrice - xlEntryPrice)*xlExitQty)*Instrument.MasterInstrument.PointValue),2);
xlDollarRisk = Math.Round(((intRisk)*Instrument.MasterInstrument.PointValue),2);
xlRmultiple = xlPnL/xlDollarRisk;
UpdateExcel();
exitLong = null;
exitLongStop = null;
}
}
//Short Trades ***************************************************************************************
if (enterShort != null && enterShort.Token == execution.Order.Token)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
}
if (execution.Order.OrderState != OrderState.PartFilled)
{
myEntryBar = CurrentBar;
myBarsSinceEntry = 1;
PShort = true;
intRisk = (MaxCloud[0] - execution.Order.AvgFillPrice);
FToB = true;
if(Close[0] > RiskS[0])
{
exitShort = ExitShort("B2C","S2O");
}
else
{
exitShortStop = ExitShortStop(0, true, execution.Order.Quantity, RiskS[0], "ATR-S", "S2O");
}
//Spreadsheet
xlLongShort = "Short";
xlEntryTime = execution.Order.Time;
xlEntryQty = execution.Order.Quantity;
xlEntryPrice = execution.Order.AvgFillPrice;
enterShort = null;
}
}
// Reset our stop order and target orders' IOrder objects after our position is closed.
if ((exitShortStop != null && exitShortStop == execution.Order))
{
if (execution.Order.OrderState == OrderState.Filled && execution.Order.OrderState != OrderState.PartFilled)
{
PShort = false;
//Spreadsheet
xlExitTime = execution.Order.Time;
xlExitQty = execution.Order.Quantity;
xlExitPrice = execution.Order.AvgFillPrice;
xlPnL = Math.Round((((xlEntryPrice - xlExitPrice)*xlExitQty)*Instrument.MasterInstrument.PointValue),2);
xlDollarRisk = Math.Round(((intRisk)*Instrument.MasterInstrument.PointValue),2);
xlRmultiple = xlPnL/xlDollarRisk;
UpdateExcel();
exitShortStop = null;
}
if(execution.Order.OrderState == OrderState.Rejected)
{
exitShortStop = null;
}
if(execution.Order.OrderState == OrderState.Rejected)
{
exitShortStop = null;
}
}
if(exitShort != null && exitShort == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled && execution.Order.OrderState != OrderState.PartFilled)
{
PShort = false;
//Spreadsheet
xlExitTime = execution.Order.Time;
xlExitQty = execution.Order.Quantity;
xlExitPrice = execution.Order.AvgFillPrice;
xlPnL = Math.Round((((xlEntryPrice - xlExitPrice)*xlExitQty)*Instrument.MasterInstrument.PointValue),2);
xlDollarRisk = Math.Round(((intRisk)*Instrument.MasterInstrument.PointValue),2);
xlRmultiple = xlPnL/xlDollarRisk;
UpdateExcel();
exitShort = null;
exitShortStop = null;
}
}
}
#endregion
#region SetUpSpreadsheet
private void SetUpSpreadsheet()
{
OpenWorkbook(excelFile);
excelSheet = (Excel._Worksheet)FindSheet(excelWorkBook, excelSheetName);
if (excelSheet == null)
{
Alert("openError", NinjaTrader.Cbi.Priority.High, "Error opening spreadsheet - check indicator parameters",
"Alert1.wav", 10, Color.Black, Color.Yellow);
}
try
{
excelApp.Visible = true;
excelApp.UserControl = true;
excelOpen = true;
}
catch
{
Alert("Exception formatting Excel", NinjaTrader.Cbi.Priority.High, "Error opening spreadsheet - check indicator parameters",
"Alert1.wav", 10, Color.Black, Color.Yellow);
}
}
// Return the worksheet with the given name.
private Excel.Worksheet FindSheet(Excel._Workbook excelWorkBook, string excelSheetName)
{
foreach (Excel.Worksheet excelSheet in excelWorkBook.Sheets)
{
if (excelSheet.Name == excelSheetName) return excelSheet;
}
return null;
}
// Open the workbook
private void OpenWorkbook(string FileName)
{
try
{
excelApp = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
}
catch
{
excelApp = new Microsoft.Office.Interop.Excel.Application();
}
simpleFileName = Path.GetFileName(excelFile);
try
{
excelWorkBook = excelApp.Workbooks.get_Item(simpleFileName);
}
catch
{
excelWorkBook = (Excel._Workbook) (excelApp.Workbooks.Open(excelFile,
false, true, Type.Missing,Type.Missing, Type.Missing, Type.Missing,Type.Missing,
Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing,Type.Missing));
}
}
#endregion
}
}
I removed my Entry Rules and exit rules, but keep the parts about sending trades to excel.. Keep in mind this is based on Iorder execution rules.
Also, I am sorry about removing a lot of the code, but I really can't share too much. However, if you are experienced in building trade systems than there is plenty information here to get you started building a log that exports to excel.
If you have any questions feel free to ask.
Cheers,
Sody
"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
June 13th, 2014, 11:50 PM
Austin TX
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 421 since Sep 2013
Thanks Given: 117
Thanks Received: 1,085
If there is a lot of interest in this, I can build a generic on based on MA crosses. Let me know.
Sody
"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
June 14th, 2014, 01:00 AM
Germany
Experience: Intermediate
Platform: Ninjatrader
Broker: IB and zen-Fire
Trading: NQ
Posts: 92 since Apr 2010
Thanks Given: 8
Thanks Received: 39
Big Mike
The most popular one on nexusfi.com (formerly
BMT ) is this one:
Check end of thread, it's continually developed.
Mike
Hey Mike thanks
it is a great thread but way to complicated for me. I need somethig easy and stupid you knwo.
Cheers
Axel
June 14th, 2014, 01:01 AM
Germany
Experience: Intermediate
Platform: Ninjatrader
Broker: IB and zen-Fire
Trading: NQ
Posts: 92 since Apr 2010
Thanks Given: 8
Thanks Received: 39
SodyTexas
If there is a lot of interest in this, I can build a generic on based on MA crosses. Let me know.
Sody
Thanks!
June 14th, 2014, 07:05 AM
Isla Mujeres, MX
Legendary Market Wizard
Experience: Advanced
Platform: NinjaTrader
Broker: Ninjatrader / Optimus Futures / AmpFutures
Trading: ES / 6E / 6B / CL
Frequency: Every few days
Duration: Minutes
Posts: 1,609 since Aug 2009
Thanks Given: 11,327
Thanks Received: 2,743
SodyTexas
If there is a lot of interest in this, I can build a generic on based on MA crosses. Let me know.
Sody
Great idea
Thanks
Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind . . .
But Learning to Dance in the Rain ! ! !
Last Updated on June 14, 2014