MODE_SPREAD - page 3

 
ToneGarot:


"Risked" is past tense. That's not what I seek.


It doesn't matter which tense, the spread does not figure in the calculation.

If a Sell trade is opened at 1.0000 with a stoploss of 1.0020, the risk is 0.0020 and say that equates to a risk of $200

If the spread is 0.0001, the trade will hit the stop when the bid is 1.0019 and the ask is 1.0020 with a loss of $200 (price movement 0.0019)

If the spread is 0.0005, the trade will hit the stop when the bid is 1.0015 and the ask is 1.0020 with a loss of $200 (price movement 0.0015)

The only difference that the spread makes is how far price has to move to hit your stop

 
GumRai:

the spread does not figure in the calculation.


My understanding is that OANDA's fees are through spreads. No fixed fees; just spread.

So, as per: https://www.incrediblecharts.com/trading/2_percent_rule.php

Applying the 2 Percent Rule

  1. Calculate 2 percent of your trading capital: your Capital at Risk
  2. Deduct brokerage on the buy and sell to arrive at your Maximum Permissible Risk

As per item 2, I want to deduct the brokerage fee. How do I deduct OANDA's fee if not through the spread?

 
ToneGarot:

My understanding is that OANDA's fees are through spreads. No fixed fees; just spread.

So, as per: https://www.incrediblecharts.com/trading/2_percent_rule.php

Applying the 2 Percent Rule

  1. Calculate 2 percent of your trading capital: your Capital at Risk
  2. Deduct brokerage on the buy and sell to arrive at your MaximumPermissible Risk

As per item 2, I want to deduct the brokerage fee. How do I deduct OANDA's fee if not through the spread?

That is not how it works! Yes, spread is a cost, but the risk (or reward) is based on the difference between the Open And Close Prices, which are already offset by the spread.

Since there is a difference between Ask and Bid (the Spread) and since the Open Price (is the Ask for a buy order) and the Close Price (is the Ask for Sell Order), where the Ask price already includes the spread (Ask = Bid + Spread), the difference between Open and Close already includes the spread cost.

So, the Risk (or a reward) is calculated based on the Open/Close difference and already includes the spread cost. You don't need to expressly include it in the calculation. You would only need to include the spread cost if both the Open and Close prices were both Bid prices (but they are not).

PS! The close price is either a manual close, a Stop-Loss or a Take-Profit.

 
Thanks for the explanation. And thanks to GumRai, also. I see what you were getting at now.
 
ToneGarot: I am trying to calculate the maximum allowed position size before opening a trade
  1. In code
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerlot + CommissionPerLot) (Note OOP-OSL includes the SPREAD)
    • Do NOT use TickValue by itself - DeltaPerlot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
  2. Use a GUI: Indicators: Money Manager Graphic Tool - MQL5.community traders' Forum - Page 5 'Money Manager Graphic Tool' indicator by 'takycard'
  3. For a short position you must use an average spread. I use a power mean to get the average maximum spread. Call per tick.
       //{ Average maximum Spread
       #define EMA(P, C, L) ((P) + (2./((L)+1))*((C)-(P)))
       // https://en.wikipedia.org/wiki/Generalized_mean#Special_cases (Power Mean)
       #define PMA(P, C, L, PM) MathPow(EMA(MathPow(P,PM), MathPow(C,PM), L), 1.0/PM)
    
       static const string  ms = "MaxSpread_" + _Symbol;
       static const double  PM = 10;
       double maxSpread; GlobalVariableGet(ms, maxSpread);
                            if(maxSpread == 0.0)  maxSpread = (Ask - Bid) / _Point;
       double curSpread = (Ask - Bid) / _Point;
       maxSpread = PMA(maxSpread, curSpread, Volume[1], PM);
                         GlobalVariableSet(ms, maxSpread);
    //        // Draw only bar zero, or on the first time bar one also. Don't redraw on a
    //        // reconnection (i.e. same period, but prev_calculated is zero.)
    //        static ENUM_TIMEFRAMES  spreadDrawn = PERIOD_CURRENT;
    //   for(int iSpr = int(spreadDrawn != _Period); iSpr >= 0; --iSpr)
    //      upSLSpread[iSpr] = upSL[iSpr] + maxSpread *_Point;
    //   spreadDrawn = (ENUM_TIMEFRAMES) _Period;
       //} Average maximum Spread

 


Nice tool!



WHRoeder:

For a short position you must use an average spread. I use a power mean to get the average maximum spread. Call per tick.


Power mean . . . if I recall from my math days, that's a weighted mean. Interesting.

Since the spread is not used to calculate lot size (as per above discussion, OOP-OSL includes the SPREAD), do you use the average maximum spread as some sort of volatility indicator to avoid entering trades in busy markets?

 

ToneGarot: Since the spread is not used to calculate lot size (as per above discussion, OOP-OSL includes the SPREAD),

do you use the average maximum spread as some sort of volatility indicator to avoid entering trades in busy markets?

  1. Contradictory statement. it is used. For a sell you put the stop where it needs to be plus the spread. For trailing, you use your value plus the spread.
  2. Yes, in my indicators I add a second line showing value plus spread. It widens considerably, each day between 4:30-5:30 ET and of course before news.
 
Phillip:

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.


Is this statement true for all brokers?

I have observed that my broker, for a Long Position, opens the pending order at the Ask level, it shows a small initial spread loss, and when Bid touch the opening level, the balance of the position is at 0.

For Short Positions, opens the pending order at the Bid level, it shows a small initial spread loss, and when Ask touch the opening level, the balance of the position is at 0.

In both cases Spread is initially calculated and charged, both for Long and Short positions. 

 
Gabriele Guerrieri:

Is this statement true for all brokers?

I have observed that my broker, for a Long Position, opens the pending order at the Ask level, it shows a small initial spread loss, and when Bid touch the opening level, the balance of the position is at 0.

For Short Positions, opens the pending order at the Bid level, it shows a small initial spread loss, and when Ask touch the opening level, the balance of the position is at 0.

In both cases Spread is initially calculated and charged, both for Long and Short positions. 

Yes, the statement is still valid and correct, but you should also consider the "slippage" which can cause an order to open (or close) slightly off on the requested price. Slippage can be both positive (in your favour) or negative (causing more loss).  This is especially noticeable in Pending orders but it happens on Market orders as well.

However, just to prevent confusion, even if we ignore slippage, when a Market Order is opened (or a Pending Order is triggered), it is immediately in loss. So even if it is a Sell or Short at the Bid price, as soon as it opens we are immediately looking at the current possible closing price for the order, which is the Ask price, so we will see an immediate loss equivalent to the current spread. If we then consider the opening slippage, if it is negative slippage then the immediate loss is greater then the spread, and if slippage is positive, the loss will be less than the spread. When the order closes, there will be slippage there as well in a similar fashion.

 
Fernando Carreiro :

Sì, l'affermazione è ancora valida e corretta, ma dovresti anche considerare lo "scivolamento" che può causare un ordine di aprirsi (o chiudere) leggermente sul prezzo richiesto. La scivolatura può essere sia positiva o negativa (causando più perdita). Ciò è particolarmente evidente nelle ordinazioni in sospeso ma accade anche sugli ordini del Mercato.

Tuttavia, per prevenire la confusione, anche se ignoriamo lo slittamento, quando viene aperto un Ordine di Mercato (o viene attivato un Ordine in sospeso), è subito in perdita. Quindi, anche se è un Vendo o Breve al prezzo di offerta, appena si apre, stiamo guardando immediatamente l'attuale prezzo di chiusura dell'ordine, che è Ask price, so we will see an immediate loss equivalent to the current diffusion. Se poi consideriamo lo slittamento di apertura, se si tratta di slittamento negativo, allora l'immediata perdita è maggiore della diffusione e se lo slip è positivo, la perdita sarà inferiore alla diffusione. Quando l'ordine si chiude, ci saranno anche scivolamenti in modo simile.


Thank you for clarifying!

Reason: