Improving CPU speed

MPTM's new home
JonCodesBad
Trader
Posts: 50
Joined: Mon Apr 13, 2015 7:58 pm
Location: SW England.

Improving CPU speed

Post by JonCodesBad »

starger » Sat Jul 02, 2016 2:50 am wrote:

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);}
This worked for me with the older builds of Empty4. The new build should do it, too.
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 use a similar approach. Normally I go for the 'if price moves by n amount of pips, calculate this, or do this or that.'

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. :)
acostafulano
Trader
Posts: 243
Joined: Tue Dec 06, 2011 3:40 pm

Improving CPU speed

Post by acostafulano »

Hello!

I've been trying to set the affinity via the shortcut in many ways, and cannot get it to start already configured as per the core instructions I'm looking for. I think there's something wrong with the configuration.

Do you mind sharing a screenshot of how your shortcut is configured as per running under your selected affinity by default?

Thanks!
DigitalCrypto » Wed Jun 29, 2016 1:19 pm wrote:


All of my terminals run in portable mode with affinity set. Affinity is actually a Windows setting. It will assign your Empty4 terminal to run exclusively on a specific core. For example if you have a quad core computer they are 0,1,2 and 3. For a dual core computer you only get 0,1. You can activate it by setting your Empty4 shortcuts with an affinity flag like I show below to run on Core 4.

"C:\Trading\FXCM_Monitor_1\terminal.exe" /portable /affinity 3

Also notice there are no spaces in my directory paths. Empty4 acts funny with spaces particularly if you've installed it in "Program Files" and have Windows UAC (User Access Control) enabled. You will need to run Empty4 in administrator mode if you do or just move it into its own directory like I've done.

.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Improving CPU speed

Post by DigitalCrypto »

I could show you a short cut but you wouldn't be able to see the whole command. That's why I posted it. You have to manually change the start menu shortcuts also.
frenchstep
Posts: 2
Joined: Tue Jun 30, 2015 2:36 am

Improving CPU speed

Post by frenchstep »

Hi,

I too have not been successful in setting affinity through the shortcut. I have tried everything, when I verify if the affinity is correctly set through Task Manage, I see no affinity is set. If I manually set it, it works but through the shortcut it does not work. Perhaps I have done something wrong. Can someone help please.

Much appreciated
French
You do not have the required permissions to view the files attached to this post.
User avatar
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Improving CPU speed

Post by tomele »

Hi,

you must run it thru the shell:

C:\Windows\System32\cmd.exe /C start /affinity 1 "C:\Program Files (x86)\Global Prime - Empty4 4\terminal.exe"

And bear in mind, that affinity number is converted to a binary number. Call it with 1,2,4,8 to test.

Happy pippin, Thomas
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Improving CPU speed

Post by DigitalCrypto »

Ahhh maybe it was a Windows 10 thing? I am still on 7 and Linux primarily
frenchstep
Posts: 2
Joined: Tue Jun 30, 2015 2:36 am

Improving CPU speed

Post by frenchstep »

Thanks, Windows 10 does not set the affinity. I will try some more research. If anyone does come across an easier way of setting the shortcut permanently in windows 10 would sure appreciate it.

thanks
French
mejayusa
Trader
Posts: 21
Joined: Thu Oct 30, 2014 10:35 pm

Improving CPU speed

Post by mejayusa »

DigitalCrypto » Tue Jul 05, 2016 5:04 pm wrote:Ahhh maybe it was a Windows 10 thing? I am still on 7 and Linux primarily
Is there a trading terminal/software for Linux env?
investguy
Posts: 7
Joined: Wed Apr 18, 2012 5:17 am

Improving CPU speed

Post by investguy »

mejayusa » Tue Jul 05, 2016 3:16 pm wrote:
DigitalCrypto » Tue Jul 05, 2016 5:04 pm wrote:Ahhh maybe it was a Windows 10 thing? I am still on 7 and Linux primarily
Is there a trading terminal/software for Linux env?

Yes. You can use WINE to run Empty4 in Linux. I don't believe it will improve speed though.
thomasmore
Trader
Posts: 275
Joined: Tue Nov 15, 2011 10:35 pm
Location: Knokke, Belgium

Improving CPU speed

Post by thomasmore »

Hi all,
Reducing bar history and setting core affinity made a big improvement. :clap:
My question: I have a large number of indicators an EA's in the Navigator. Would they use memory, even if they are not on a chart?
Cheers,
Ludo
Post Reply

Return to “Utilities Indicators and Scripts”