MQL4 - automated forex trading   /  

Forum

MODE_SPREAD

Back to topics list  | 1 2 To post a new topic, please log in or register

avatar
8
PaulHister 2010.09.12 19:19 
When I use MODE_SPREAD, does it count the spread to open a position or does it count the spread to open and close the position?
Enhancing the Quality of the Code with the Help of Unit Test

Enhancing the Quality of the Code with the Help of Unit Test

Even simple programs may often have errors that seem to be unbelievable. "How could I create that?" is our first thought when such an error is revealed. "How can I avoid that?" is the second question which comes to our mind less frequently. It is impossible to create absolutely faultless code, especially in big projects, but it is possible to use technologies for their timely detection. The article describes how the MQL4 code quality can be enhanced with the help of the popular Unit Testing method.


avatar
716
1005phillip 2010.09.12 19:40 

It only tells you the spread to open a new long position and the spread to close an existing short position.

You pay the spread at the time of position open for longs. For short positions you pay the spread at the time of close for the position.

Since the time of close is a time in the future, you don't know the spread you are going to pay on the short position until you actually close it.


avatar
8
PaulHister 2010.09.12 20:11 

I'm still in trouble, not so fluent in english ;-)

I mean, I open a position and I close it,

Should I count:

Spread = MarketInfo(sym, MODE_SPREAD);

or

Spread = MarketInfo(sym, MODE_SPREAD) * 2;


avatar
716
1005phillip 2010.09.12 20:58 

Spread = MarketInfo(sym, MODE_SPREAD);

You only pay the spread once.

Just be aware that the spread value computed with this method may not actually be the spread value you paid for your specific position (because spreads are variable, even for so-called fixed-spread brokers because they liberally take advantage of that fine print which says they will still change spreads during periods of high market volatility and/or low-liquidity)...


avatar
8
PaulHister 2010.09.12 22:57 

Thanks a lot 1005phillip for your answer!

You help me a lot. Thanks again


avatar
39
FXMan77 2010.09.13 00:04 
1005phillip:

Spread = MarketInfo(sym, MODE_SPREAD);

You only pay the spread once.

Just be aware that the spread value computed with this method may not actually be the spread value you paid for your specific position (because spreads are variable, even for so-called fixed-spread brokers because they liberally take advantage of that fine print which says they will still change spreads during periods of high market volatility and/or low-liquidity)...


What about Slippage.

With ECN broker you are paying for spread + slippage.


avatar
716
1005phillip 2010.09.13 00:49 
FXMan77:


What about Slippage.

With ECN broker you are paying for spread + slippage.


Slippage is a cost-adder, but that isn't germane to the OP.

Are you inquiring as to how to determine the slippage, if any, paid on an order?

If you want to start listing all the things you may end up paying for with an order then you definitely want to include slippage as well as rollover fees, swap debit or credt, and any round-trip commision/fees paid to the broker as well as fees paid to your signal provider and EA provider (when applicable) not too mention performance fees that might be assessed periodically (say monthly). And there may be some credits in there if you have referral bonuses kicking back a portion of the spread and so on.

avatar
39
FXMan77 2010.09.13 03:28 
1005phillip:

Slippage is a cost-adder, but that isn't germane to the OP.

Are you inquiring as to how to determine the slippage, if any, paid on an order?

If you want to start listing all the things you may end up paying for with an order then you definitely want to include slippage as well as rollover fees, swap debit or credt, and any round-trip commision/fees paid to the broker as well as fees paid to your signal provider and EA provider (when applicable) not too mention performance fees that might be assessed periodically (say monthly). And there may be some credits in there if you have referral bonuses kicking back a portion of the spread and so on.


Spread is the same for long or short, if you open a position, I thing.

Brokers are making money on spread Plus on Slippage, they can give you any spread and any slippage.

You can start from -200pips e.g.

Attached files:
  Spread_Indicator.ex4 (3.15 KB)

avatar
716
1005phillip 2010.09.13 05:59 
FXMan77:


Spread is the same for long or short, if you open a position, I thing.

Brokers are making money on spread Plus on Slippage, they can give you any spread and any slippage.

You can start from -200pips e.g.


I still don't understand the relevance of slippage in this thread. The OP asked about spread, not total expenses which includes spread and slippage plus many other possible expenses.

Your first comment is incorrect. Short positions are opened at the bid price which does not include spread, short positions are closed at the ask price which does include spread.

Spread is only the same for long and short IF spreads are not variable, which is never the case even with fixed-spread brokers.


avatar
539
Viffer 2010.09.13 13:01 

As phillip says, it's slightly off topic, but seeing as I think OP has his answer... FXMan, you have asked about slippage before and I don't think you understand it properly so let me try and explain. You are quoted a Bid and an Ask. You want to buy so send an order to buy at the quoted ask. But in the time it takes you to transmit and the broker to place the order, the ask can sometimes change. So the price you were quoted is no longer valid. You've had slippage. In ordersend the slippage parameter gives the broker permission to go ahead and place the trade if the slippage is less than the value you specified. Standard, I believe, is 3 pips. If the price has slipped more than that, the broker will not place the order and tell you re quote of invalid price. Slippage is part of the game and is a cost you pay for being slow in a fast market.

V


avatar
716
1005phillip 2010.09.13 15:52 

In the theme of the movie pirates of the caribbean, our knowledge on what happens behind the scene regarding slippage slippage is more based on guidelines than on hard-rules per se.

https://www.nfa.futures.org/basicnet/Case.aspx?entityid=0339826&case=10BCC00015&contrib=NFA

The rules exist, we just don't know what they are and the brokers are at liberty to define those rules to our ignorance. There is a reason FXMan77 is worried about -200pips, it is a valid concern, but it should be in its own thread IMO.

Back to topics list   | 1 2  

To add comments, please log in or register