I use a similar approach. Normally I go for the 'if price moves by n amount of pips, calculate this, or do this or that.'starger » Sat Jul 02, 2016 2:50 am wrote:This worked for me with the older builds of Empty4. The new build should do it, too.Code: Select all
// on Global Scope extern bool LowCPU = true; extern int Divisor = 4; // only calculate every 4th tic // first line in start() if(LowCPU && Volume[0]/Divisor !=MathCeil(Volume[0]/Divisor)){return(0);}
I simply added these lines to my indicators and took different divisors for each indicator.
This does not speed up the the computer but it reduces the number of calculations and distributes the usage of CPU.
I would strongly urge everyone to learn MQL4. It isn't too difficult! Before going live with real money optimize your EA. Just ask yourself, do I need to calculate this every tick, every new bar, every 10 seconds, every 5 pips etc. This can include indicator calls, jumping SL, group closure etc.
Seriously, If I can code basic EA's anyone can! I'm slightly dyslexic and of average intelligence, so the vast majority here have no excuse.