|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
When you are working with an EA, is it possible to put the values of a created variable in a graph/log or do you need to create the same variable in an indicator in order to see the values?
Any tips on how to develop/debug EA are appreciated. Thanks |
|
|||
|
Write vairables to a file
Hi
I debug by writing the variables to a file. Then I open the file in excel and try to figure out if all went according to plan. It is a pretty long winded way of doing things - but it does work. If anyone knows how to delete a file in the 'int init()' please let me know, as I always have to delete the file before running a new test. Thanks. Code:
...
if(TP > 0)
realTP = Ask + TP * Point;
ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slippage,realSL,realTP,nameEA+" - Magic: "+magicEA+" ",magicEA,0,Red); // Buy
if(ticket < 0) {
Print("OrderSend (" + nameEA + ") failed with error #" + GetLastError() + " --> " + ErrorDescription(GetLastError()));
writetofile("8","Error buyagain?",ErrorDescription(GetLastError()));
} else {
firstbuysl = realSL;
writetofile("12za","first buy", OrderTicket());
}
void writetofile(string breakpoint1, string description1, string description2) {
int handle;
handle=FileOpen("bedug1.dat", FILE_CSV|FILE_WRITE|FILE_READ, ";");
if(handle>0){
// write data
FileSeek(handle,0,SEEK_END);
FileWrite(handle, breakpoint1, description1,description2, CurTime(), Year(), Month(), Day(),Hour(),Minute(),Seconds(), Bid, Ask,tstop, long_ma, numberofbuys, numberofsells, firstbuycheck, firstsellcheck,firstbuyprice, firstsellprice,firstbuysl, firstsellsl, isBuying, isSelling, isClosing, lasttradeprice, x,y,sell_trade_again, buy_trade_again,shortEma, longEma, isCrossed);
FileClose(handle);}
}
|
|
|||
|
File writes from stratergy tester
Please note files writen while doing 'stratergy test' are writen to .../tester/Files
and I found a way to write the results out to a different file each time. In 'start int' one has to make a file name based on the current time - then use this file name as a file to write to. I will hopefully post this solution up here tonight. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Debugging EA with printouts? | resalin | Setup Questions | 3 | 05-05-2007 12:37 PM |
| Debugging | Q0paz | Metatrader 4 | 3 | 11-09-2006 11:52 AM |