Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
I'm programming ea witch uses files to keep results of trade (loss, win) with indicators values .So when EA enters trade i write values of indicators and time ,when trade was made, to file "sellOpenInd.tab":
After this operation file includes:
In next stage i open this file and look into history for dates of opened orders then i check results of this trades and write into file "sellResults.tab"+indicators values writen in previous stage(above) .And here problem occures, only one same trade is recorded:
int dates=FileOpen("sellOpenInd.tab", FILE_CSV|FILE_READ,"\t");
if(dates>0){
for(k=0;k<=10;k++){ //i use for loop instead of while(!FileIsEnding(dates) ) because ea enters in infinite loop for unknown reasons
dates=FileOpen("sellOpenInd.tab", FILE_CSV|FILE_READ,"\t");
FileSeek(dates,filepos,SEEK_SET);
while (FileIsLineEnding(dates)==FALSE){filestr=FileReadString(dates)+"\t"+filestr;filepos=filepos+FileTell(dates);}
decodeFile(filestr);//calling function which decodes readed string line, then writing results to global varaiables filter7 ,filter6 etc.
Comment(filterS7);
for (i =OrdersHistoryTotal()-1; i>=0; i--) {
OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
if (OrderSymbol() == Currencies) {
if((OrderMagicNumber()==16381||OrderMagicNumber()==16383)&&OrderCloseTime()!=0){
historyDateTime=TimeToStr(OrderOpenTime());
OrderP=OrderProfit();
if(OrderP>0)orderresult="win";
if(OrderP<=0)orderresult="loss";
if(filterS7==historyDateTime) {
testFline=filterS6+"\t"+filterS5+"\t"+filterS4+"\t"+filterS3+"\t"+filterS2+"\t"+filterS1+"\t"+filterS0+"\t"+orderresult;
results=FileOpen("sellResults.tab", FILE_READ|FILE_WRITE,"\t");
FileSeek(results,0,SEEK_END);
FileWrite(results,testFline);
testFline="";
filestr="";
}
}
}
}
if(!FileIsEnding(dates)){FileClose(dates);FileClose(results);filepos=0;break;
}
}
}
Every step in your cicle you open file "sellOpenInd.tab" again and again.
Try this:
Code:
int dates=FileOpen("sellOpenInd.tab", FILE_CSV|FILE_READ,"\t");
if(dates>0){
for(k=0;k<=10;k++){ //i use for loop instead of while(!FileIsEnding(dates) ) because ea enters in infinite loop for unknown reasons
FileSeek(dates,filepos,SEEK_SET);
while (FileIsLineEnding(dates)==FALSE){filestr=FileReadString(dates)+"\t"+filestr;filepos=filepos+FileTell(dates);}
decodeFile(filestr);//calling function which decodes readed string line, then writing results to global varaiables filter7 ,filter6 etc.
Comment(filterS7);
for (i =OrdersHistoryTotal()-1; i>=0; i--) {
OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
if (OrderSymbol() == Currencies) {
if((OrderMagicNumber()==16381||OrderMagicNumber()==16383)&&OrderCloseTime()!=0){
historyDateTime=TimeToStr(OrderOpenTime());
OrderP=OrderProfit();
if(OrderP>0)orderresult="win";
if(OrderP<=0)orderresult="loss";
if(filterS7==historyDateTime) {
testFline=filterS6+"\t"+filterS5+"\t"+filterS4+"\t"+filterS3+"\t"+filterS2+"\t"+filterS1+"\t"+filterS0+"\t"+orderresult;
results=FileOpen("sellResults.tab", FILE_READ|FILE_WRITE,"\t");
FileSeek(results,0,SEEK_END);
FileWrite(results,testFline);
testFline="";
filestr="";
}
}
}
}
if(!FileIsEnding(dates)){FileClose(dates);FileClose(results);filepos=0;break;
}
}
}
I am testing an EA on demo account and would to add stop loss trailing methods to it. I have a seperate ea that handles the stop loss trailing methods where you can select the one you want. Would appreciate any feedback. Thank you
I looking for a just sell EA. If you have something like that, just put it here please. I want to write a sell EA what included some indicators... thanx your help!
Can any gracious coder/FxPro trader kindly figure out why I can't use this EA on FxPro's MT4 platform. I just can't seem to get EA to open a single trade for the life of me even with the default settings after many days.
FxPro uses the 5-digit format for their price and I've been wondering whether it's the reason. Can this be modified in the code? Someone pls help, it's slowly driving me nuts. Thanx in anticipation
Great forum :-)
I would like to know, I use money management to calculate lot size in my EA's, up until now my base currency has always been USD but could someone provide some code to calculate lot size if base currency is not USD, for example EUR etc ? Thanks in advance !