MODE_SPREAD

Back to topics list  | 1 2 3 To post a new topic, please log in or register
avatar
Moderator
3423
GumRai 2016.09.06 23:13 #
 
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

avatar
6
ToneGarot 2016.09.06 23:53 #
 
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?


avatar
1229
FMIC 2016.09.07 00:00 #
 
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.

avatar
6
ToneGarot 2016.09.07 00:14 #
 
Thanks for the explanation. And thanks to GumRai, also. I see what you were getting at now.
avatar
13008
WHRoeder 2016.09.07 16:40 #
 
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

avatar
6
ToneGarot 2016.09.07 23:31 #
 



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?



avatar
13008
WHRoeder 2016.09.08 16:59 #
 

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.

Back to topics list   | 1 2 3  

To add comments, please log in or register