- Running backtesting multiple times slows down with each test
- Collaboration Dolly + Isakas + Nina System
- Backtest sometimes slow sometimes fast. Why?
It has to do with your setting
It has to do with your setting
I found a bug in the compiler but fixing the code has still not made it run fast again. For some reason the compiler thinks this code is correct but clearly it isn't. The compiler has missed the "vspread=" and a semicolon. Not sure why the colours are messed up in the code segment. Another strange thing is that the original EA now runs fast without doing any changes but the copy that I was going to mess around with to find the slow problem is still running slow.
int DecideEntry(){ static double hilvl,lolvl; static int initok=0,togin=1; int trdun,trdseq,vspread; trdseq= PKamaOP(periodAMA,nfast,nslow,G,dK); if(trdseq!=0){ togin=0; vspread = hilvl=kama; // hilvl=iMA(NULL, 0, 3, 0, MODE_SMA, PRICE_OPEN, 0); lolvl=hilvl-pnt*Level; hilvl=hilvl+pnt*(Level+(Ask-Bid)/2); // Comment("Seq1 HiL= ",DoubleToString(hilvl)," LoL= ",DoubleToString(lolvl)," vspread= ",(vspread*pnt/2));
The problem could be with your indicators, according the way they are coded,
either if an extern is missing or if there is an additional extern, the icustom could work, but slow the EA,
try to replace this
trdseq= PKamaOP(periodAMA,nfast,nslow,G,dK);
with this
trdseq= iCustom( NULL,0,"name_of_kama", periodAMA,nfast,nslow,G,dK, buffer, index );
following the kama you use
Some more information after a brain wave & the observation that the progress bar gradually went slower towards the end of a backtest. Since the progress bar slows down slightly it must be that the length of data must be part of the problem. By editing the indicator so it only goes back a couple of bars further than period of the longest MA it uses the EA now runs very fast. What doesn't make sense is that the trigger that makes the EA go slow does not change the number of times the indicator is called it just does a bit of extra code when in a trade. Could it be my poor little computer doesn't have enough memory with 2 GB?
Another question in relation to the bars seen by the indicator is does the indicator always use all the bars from the start of a backtest? In normal operation on a live chart I know the indicator code only uses the latest tick and does not load all the bars but in a backtest it can't work like that because it is reloaded on every call. Therefore indicators have to be specially written for use in EAs so they only load the bars they need.
I have been developing an EA but after a few backtest runs it now goes really slowly. It runs fast on my other computer with the same broker like it used to do where it runs slow now. It has nothing to do with my EA code and I have cleared all the log files, caches or any other files related to the EA but no change so I reinstalled MT4 but still runs slow. Equally it can't be the history file since other programs run fast over the same dates so I don't know where to look for the problem. This is really irritating since it takes minutes to run a backtest that should only take 15 seconds. Any ideas?
I found a bug in the compiler but fixing the code has still not made it run fast again. For some reason the compiler thinks this code is correct but clearly it isn't. The compiler has missed the "vspread=" and a semicolon. Not sure why the colours are messed up in the code segment. Another strange thing is that the original EA now runs fast without doing any changes but the copy that I was going to mess around with to find the slow problem is still running slow.
That's not a bug, this code is valid. The compiler can't detect logical errors.
Please show your code if you need help.
Find the bottleneck using the current GMT time and Print. To get the real world GMT time during backtesting (ie. OS/PC time not the modelled time) use the output from GlobalVariableSet() e.g.
//untested/uncompiled
datetime logtime(string msg)
{
datetime now = GlobalVariableSet(WindowExpertName()+"#time");
Print(TimeToStr(now,-1),msg);
}
There might be a better way?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use