Jump to content

Max Spread


swordfish

Recommended Posts

We must see some more code to be able to help you,this is just initialisation of double but where you use it in code,what conditions...?Give us some more code.

 

Ah, yes. I need to compare bid/ask difference with the user set input maxspreadpips. My question is general so I can insert the code in all the EAs that are not limiting the spreads. There must be a standard block of IF_THEN routine to limit the spread. Take the simple moving average EA in MT4 for example. What do you add so that the maxspreadpips will be active?

Link to comment
Share on other sites

You must first add the following:

 

int Spread = MarketInfo(Symbol(),MODE_SPREAD);

 

then your programming logic, example:

 

if (Spread > MaxSpreadPips) return (0); // Do not trade if spread more than 2.2pips

 

For 4 digit platform you should set MaxSpreadPips = 2.2, and 5 digit platform you set it to MaxSpreadPips = 22;

 

Hope this help.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...