English

 Moderator3508 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 \$200If 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
 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.phpApplying the 2 Percent RuleCalculate 2 percent of your trading capital: your Capital at RiskDeduct brokerage on the buy and sell to arrive at your Maximum Permissible RiskAs per item 2, I want to deduct the brokerage fee. How do I deduct OANDA's fee if not through the spread?
 13118 WHRoeder 2016.09.07 16:40 #   ToneGarot: I am trying to calculate the maximum allowed position size before opening a tradeIn 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 Use a GUI: Indicators: Money Manager Graphic Tool - MQL5.community traders' Forum - Page 5 'Money Manager Graphic Tool' indicator by 'takycard'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```