i can't see it on my mt4,how to solve this problem
i can't see it on my mt4,how to solve this problem
I just checked and it works with no problem on demo account but not during back testing of EA. Any idea how to modify (if it is possible) to have it working during back test of EA ??
Krzysztof
I just checked and it works with no problem on demo account but not during back testing of EA. Any idea how to modify (if it is possible) to have it working during back test of EA ??
Krzysztof
Thanks a lot for the info. just for clarification. In the related article they say
But there is one problem: the indicator, displayed on the testing visualization
chart, does not have the access to the state of the tested account. All functions, responsible for this information, return the values of the
real account.
So will your indicator be able to retrieve trade information from traded account or I have to call its funcionality from EA ?? In the example in the article they are saying only about AccountBalance and equity but not about trade info.
Krzysztof
I just checked and it works with no problem on demo account but not during back testing of EA. Any idea how to modify (if it is possible) to have it working during back test of EA ??
Krzysztof
For balans back testing I use something like this:
1) in the expert code I write balans value to the file
2) in the indicator - I read this file and display result.
In the expert I have code:
global varibales:
int maxasize = 10000; // number of balans values for each bar
int asize = 336; // 7days, 30 min TF
double aBalans[1][2];
double gPreviTime=0;
string gUseIncreaseMartinsFile = "UseIncrease.dat";
int start()
{
SaveBalans();
.....
}
void SaveBalans()
{
double tmp1,tmp2,dmp1,dmp2,pr=gUseIncreaseMartinsFlatRate+1,pr1;
int s;
string aa;
if(bNewBar()==true)
{
Print("iCustom=",iCustom(NULL, 0, "grabli[balans]", 0, 0));
tmp1 = aBalans[0,0];
dmp1 = aBalans[0,1];
aBalans[0,0]=AccountBalance();
aBalans[0,1]=TimeCurrent();
tmp2 = aBalans[1,0];
dmp2 = aBalans[1,1];
aBalans[1,0]=tmp1;
aBalans[1,1]=dmp1;
for(s=2; s<maxasize; s++, s++)
{
tmp1=aBalans[s,0];
dmp1=aBalans[s,1];
aBalans[s,0]=tmp2;
aBalans[s,1]=dmp2;
tmp2=aBalans[s+1,0];
dmp2=aBalans[s+1,1];
aBalans[s+1,0]=tmp1;
aBalans[s+1,1]=dmp1;
}
int handle=FileOpen(gUseIncreaseMartinsFile,FILE_BIN|FILE_WRITE);
if(handle>0)
{
FileWriteArray(handle, aBalans, 0, maxasize*2); // writing whole array
FileClose(handle);
}
for(s=0;s<asize; s++)
{
if(aBalans[s,0]!=aBalans[s-1,0]) aa = aa + "\n" + DoubleToStr(aBalans[s,0],2) + " " + DoubleToStr(aBalans[s,1],0);
}
if((aBalans[asize-1,0])>0) { pr=NormalizeDouble(((AccountBalance()*100)/(aBalans[asize-1,0]))-100,2); pr1=NormalizeDouble((AccountBalance()*100/iCustom(NULL, 0, "grabli[balans]", 1, 0))-100,2); }
Comment("Weekly Profit=",pr + " ; " + pr1 + "\n", DoubleToStr(aBalans[asize-1,0],2) + " " + DoubleToStr(aBalans[asize-1,1],0) + " " + iCustom(NULL, 0, "grabli[balans]", 0, 0) + " " + iCustom(NULL, 0, "grabli[balans]", 1, 0) + "\n" + "\n" + aa);
Print("weekly profit=",pr, " ; Balans=",AccountBalance(), " ; PrevBalans=",aBalans[asize-1,0] );}
}
/***********************************************/
bool bNewBar()
{
if( gPreviTime < iTime ( 0, 0, 0 ) )
{
gPreviTime = iTime ( 0, 0, 0 ) ;
return ( TRUE ) ;
}
else
{
return ( FALSE ) ;
}
}
Indicator itself looks like this:
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
//--- input parameters
extern int asize=10000;
extern int maMethod = MODE_SMA;
extern int period = 200;
double gUseIncreaseMartinsFlatRate=10;
//--- buffers
double aBalans[];
double iBalans[];
double ans[1][2];
double gPreviTime;
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,aBalans);
IndicatorDigits(Digits+1);
SetIndexDrawBegin(1,0);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,iBalans);
IndicatorDigits(Digits+1);
IndicatorShortName("Balans");
SetIndexLabel(0,"Balans");
SetIndexLabel(1,"iMaBlanas");
if(ArraySize(ans)==1) { ArrayResize(ans,asize*2); }
return(0);
}
//+------------------------------------------------------------------+
int deinit() { return(0); }
//+------------------------------------------------------------------+
int start()
{
int i,k;
int limit;
int length;
int countedBars;
double ans1[1],ans2[1];
int handle=FileOpen("UseIncrease.dat",FILE_BIN|FILE_READ);
if(handle>0)
{
FileReadArray(handle, ans, 0, asize*2);
FileClose(handle);
}
ArrayResize(ans1,(ArraySize(ans)/2)+1);
ArrayResize(ans2,(ArraySize(ans)/2)+1);
for(i=0;i<=ArraySize(ans1);i++) ans1[i]=ans[i,0];
k = ArraySize(ans1) - 1;
for (i = 0; i<=k; i++) aBalans[i] = ans1[i];
for (i = k; i>=0; i--) ans2[i]=ans1[k-i];
for (i = 0; i<=ArraySize(ans1) - 1; i++) iBalans[i] = iMAOnArray(ans2, asize, period, 0, maMethod, i);
return(0);
}
And backtest result looks like this:
This indicator worked wonderfully well for a couple of weeks and then today I started getting an Alert "Transaction History is not fully loaded" "Èñòîðèÿ ñäåëîê çàãðóæåíà íå ïîëíîñòüþ" I cannot find a reason for the Alert. I have unloaded the chart and reloaded it. I have deleted the indicator and re-inserted the indicator. I have reset the indicator to the default inputs. Does anyone have any suggestions.
This indicator worked wonderfully well for a couple of weeks and then today I started getting an Alert "Transaction History is not fully loaded" "Èñòîðèÿ ñäåëîê çàãðóæåíà íå ïîëíîñòüþ" I cannot find a reason for the Alert. I have unloaded the chart and reloaded it. I have deleted the indicator and re-inserted the indicator. I have reset the indicator to the default inputs. Does anyone have any suggestions.
To solve this problem, in your MT4, just go to "Terminal" ; "Account History" ; right mouse click anywhere on "Account History" and chose "All History".
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Indicator of Equity and Balance:
Author: Игорь Корепин