#property indicator_chart_window // coded by Ben Nachtrieb mountainclimber11@yahoo.com //indicator creates a csv file in your experts>files folder for each trade that is openned //in your account. Its doesn't matter if its from and EA or manual it will record the //profit or loss of the trade so long as it is open in your platform. It also doesn't matter //how many trades you have open. It opens a new file for each trade that is openned. It also //keeps track of some other stuff. I just started to use it to help me with optimual entry, sl placement, //tp areas, and exits. I uaually graph it in excel to get a "feel" for the life of my trade and //take some notes. //super simple system! yet useful.... //nothing will show up on your chart when this is attached. A csv file is only created if there //is an open trade in the account. //enjoy! extern string FileName="DrawDownTracker"; int OrdersPerAccount, nmbr, ticket, handle; double lastprice, openprice, orderprofit; string symbol, FileNameDate,FileNameTime,FileNameSymbol,filename,date,time; datetime opentime; int start() { AccountPositionCounter(); if(OrdersPerAccount>0) { for(nmbr=OrdersTotal();nmbr>=0;nmbr--) {//if there is no order break loop if(OrderSelect(nmbr,SELECT_BY_POS, MODE_TRADES)==false){ continue;} else//if there is an order then record info openprice=OrderOpenPrice(); if(OrderType()==OP_SELL) { lastprice=MarketInfo(OrderSymbol(),MODE_ASK); orderprofit=(openprice-lastprice)/MarketInfo(OrderSymbol(),MODE_POINT); } if(OrderType()==OP_BUY) { lastprice=MarketInfo(OrderSymbol(),MODE_BID); orderprofit=(lastprice-openprice)/MarketInfo(OrderSymbol(),MODE_POINT); } symbol=OrderSymbol(); opentime=OrderOpenTime(); ticket=OrderTicket(); date=StringConcatenate(TimeMonth(TimeCurrent()),"-",TimeDay(TimeCurrent()),"-",TimeYear(TimeCurrent())); time=StringConcatenate(TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent())); FileNameDate=StringConcatenate(TimeMonth(opentime),"-",TimeDay(opentime),"-",TimeYear(opentime)); FileNameTime=StringConcatenate(TimeHour(opentime),TimeMinute(opentime)); FileNameSymbol=symbol; filename= FileName+FileNameDate+FileNameTime+FileNameSymbol; handle=FileOpen(filename+".csv",FILE_CSV|FILE_READ,","); if(handle<0)//if failed {//create new file handle=FileOpen(filename+".csv",FILE_CSV|FILE_WRITE|FILE_READ,","); if(handle>=0)//if successful {//write headers FileWrite(handle,"OrderProfit","Ticket","Symbol","Date","Time", "OpenPrice","LastPrice"); FileFlush(handle); }//write headers }//create new file if(handle>=0) { FileClose(handle); handle=FileOpen(filename+".csv",FILE_CSV|FILE_WRITE|FILE_READ,","); FileSeek(handle,0,SEEK_END); FileWrite(handle,orderprofit,ticket,symbol,date,time,openprice,lastprice,","); FileClose(handle); handle=-1; } }//for loop orderselect }//ordersperaccount }//start void AccountPositionCounter() { OrdersPerAccount=0; for(nmbr=OrdersTotal();nmbr>=0;nmbr--) { if(OrderSelect(nmbr, SELECT_BY_POS, MODE_TRADES)==false){ continue;} else OrdersPerAccount++; }//for }//void
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
Other Features:
Uses files from the file system
It writes information to file