molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Thu May 16, 2024 7:29 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Request new feature - spread protection
PostPosted: Thu Jun 14, 2012 10:46 am 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
Basically, no new position if spread > n.

For example, spread protection is part of 10points_3_smi_1.01.mq4 (EA) posted at http://www.forex-tsd.com/martingale-average-cost-hedging/3473-10points-3-mq4-409.html#post409645 (inside zip file, EA folder).

Although the example uses a calculation, I think a fixed pip value would also be nice. Maybe in some future version of SB?

(WARNING: To any would-be 10points3 traders, the above link is provided as an example of a feature only. The EA will blow your account without running appropriate filters).

To anyoneone desiring spread protection right now, I coded the attached indi which should allow us to build TA conditions that handle the spread (and swaps too). Note that this indi measures the spread in points, and measures swaps per unit in the base currency of the account... I think.


Attachments:
Spread_Swaplong_Swapshort.mq4 [2.27 KiB]
Downloaded 428 times

_________________
I'm not a programmer, but I play one on TV.
Top
 Profile  
 
 Post subject: Re: Request new feature - spread protection
PostPosted: Fri Jun 15, 2012 9:13 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Thanks. I would calculate the spread using ask and bid and wouldn't use the code to get the broker spread. I have seen cases where the broker spread is different than the actual calculation.


Top
 Profile  
 
 Post subject: Re: Request new feature - spread protection
PostPosted: Fri Jun 15, 2012 10:04 am 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
Thanks. Good to know.

It appears I retro-invented the wheel once again. Here's a link to a bid ask indicator and a spread indicator for comparison: http://codebase.mql4.com/8147. The code fix for 5 digits is about halfway down the page.

_________________
I'm not a programmer, but I play one on TV.


Top
 Profile  
 
 Post subject: Re: Request new feature - spread protection
PostPosted: Thu Jun 21, 2012 2:55 pm 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
And to make spread protection simpler, here's an indi I made in TIB. It's merely Mode 0 of the indi in my last post minus Mode 1 of same (Bid-Ask). Now anyone can import it into SB and put the Bid-Ask on one side and a User Defined Number on the other side. (You still need the original indicator in your MT4/experts/indicators folder).

By the way, the whole point of this is to keep your dealer's spread from eating into your trade profit during times of high volatility. So just punch a reasonable spread number into your TA and add it to your other TA's using AND.

This is for 5 digit pricing. Original coder's copyright prints on your screen (not mine). Enjoy.

Hope I'm allowed to post the indi mq4 along with the moi. :? We'll see.


Attachments:
Bid-Ask.moi [1.62 KiB]
Downloaded 469 times
Bid-Ask.mq4 [5.5 KiB]
Downloaded 499 times

_________________
I'm not a programmer, but I play one on TV.
Top
 Profile  
 
 Post subject: Re: Request new feature - spread protection
PostPosted: Mon Dec 22, 2014 12:31 pm 
Offline

Joined: Thu Jun 23, 2011 5:06 pm
Posts: 54
Hello

Im also looking to protect my account from High spreads. Im currently using

"MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_BID)<=3.0"

ANDed to my Molanis EA. However it does not appear to be working. The MOL file posted earlier in this post was too old for my version of Molanis to open. Im running the latest R2 version. Im hoping that someone can paste the mql line here.


Top
 Profile  
 
 Post subject: Re: Request new feature - spread protection
PostPosted: Sat Dec 27, 2014 11:25 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Should be 0.0003 for 3 pips


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009