Hi there could someone please simpily help me to code an EA that simply sends the account balance and equity to a text file .
Thanks a lot !
Thanks a lot !
.txt or .csv TO .hst conversion 12 replies
MT4 - How to save Toolbox News Data in txt or csv? 3 replies
EA/script for making trades from txt file 0 replies
TXT Trading!? 1 reply
extern string dataFile = "xl8r";
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int i;
int handle;
handle = FileOpen(dataFile,FILE_CSV|FILE_WRITE|FILE_READ,','); //';');
FileSeek(handle,0,SEEK_END);
FileWrite(handle,AccountBalance(),AccountEquity());
FileClose(handle);
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| xl8r.mq4 |
//| .....h |
//| hayseedville.com |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link "hayseedville.com"
extern string Balance = "Balance";
extern string Equity = "Equity";
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int i;
int handle;
handle = FileOpen(Balance,FILE_CSV|FILE_WRITE|FILE_READ,',');
//FileSeek(handle,0,SEEK_END);
FileWrite(handle,AccountBalance());
FileClose(handle);
//-----
handle = FileOpen(Equity,FILE_CSV|FILE_WRITE|FILE_READ,',');
//FileSeek(handle,0,SEEK_END);
FileWrite(handle,AccountEquity());
FileClose(handle);
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| xl8r.mq4 |
//| .....h |
//| hayseedville.com |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link "hayseedville.com"
extern string Balance = "Balance";
extern string Equity = "Equity";
string sym[20] = {"GBPUSDm","EURGBPm","EURJPYm","GBPJPYm","USDCHFm","AUDJPYm","NZDUSDm","EURUSDm","USDJPYm","EURCHFm","GBPCHFm","CHFJPYm","AUDUSDm","NZDJPYm" };
int time[8] = {1,5,15,30,60,240,1440,10080,43200};
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int i;
int handle;
handle = FileOpen(Balance,FILE_CSV|FILE_WRITE);
FileWrite(handle,AccountBalance());
FileClose(handle);
//-----
handle = FileOpen(Equity,FILE_CSV|FILE_WRITE);
FileWrite(handle,AccountEquity());
FileClose(handle);
//-----
for(int j=0;j<14;j++)
{
RefreshRates();
handle = FileOpen(sym[j],FILE_CSV|FILE_WRITE);
FileWrite(handle,MarketInfo(sym[j],MODE_ASK));
FileClose(handle);
}
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| xl8r.mq4 |
//| .....h |
//| hayseedville.com |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link "hayseedville.com"
extern string Balance = "Balance";
extern string Equity = "Equity";
string sym[20] = {"GBPUSDm","EURGBPm","EURJPYm","GBPJPYm","USDCHFm","AUDJPYm","NZDUSDm","EURUSDm","USDJPYm","EURCHFm","GBPCHFm","CHFJPYm","AUDUSDm","NZDJPYm" };
int time[8] = {1,5,15,30,60,240,1440,10080,43200};
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int i;
int handle;
handle = FileOpen(Balance,FILE_CSV|FILE_WRITE);
FileWrite(handle,AccountBalance());
FileClose(handle);
//-----
handle = FileOpen(Equity,FILE_CSV|FILE_WRITE);
FileWrite(handle,AccountEquity());
FileClose(handle);
//-----
for(int j=0;j<14;j++) // change the 14 to how ever many symbols you have -1....
{
RefreshRates();
handle = FileOpen(sym[j],FILE_CSV|FILE_WRITE);
FileWrite(handle,MarketInfo(sym[j],MODE_ASK));
FileClose(handle);
}
for(int k=0;k<14;k++) // change the 14 to how ever many symbols you have -1....
{
double profit;
for(int l=0; l<OrdersTotal(); l++)
{
if(OrderSelect(l, SELECT_BY_POS, MODE_TRADES))
{
if(OrderSymbol() != sym[k]) continue;
{
profit = OrderProfit();
}
}
}
handle = FileOpen(sym[k]+"Profit",FILE_CSV|FILE_WRITE);
FileWrite(handle,profit);
FileClose(handle);
}
//----
return(0);
}
//+------------------------------------------------------------------+