Categories
Forex Daily Topic Forex System Design

Designing a Trading Strategy – Part 5

Introduction

In a previous article, we presented the effect of incorporating additional rules in a trading strategy during the design process. In particular, we intuitively proposed a rule that opens a position using a size considering a percentage level of equity in the trading account.

In this educational article, corresponding to the last part of the series dedicated to designing trading strategies, we will expand position sizing concepts.

600x600

Position Sizing

The determination of the position size in each trade corresponds to the third element of a trading strategy. This decision will determine the capital that the investor will risk in each trade.

The position sizing corresponds to the volume committed in each trade. This volume can be the number of contracts, shares, lots, or another unit associated with the asset to be traded. The complexity of the position sizing is based on the efficient determination of the position to ensure maximum profitability with an acceptable risk level for the investor.

Programming the Position Sizing

To visualize the difference between some methods of position sizing, we will apply the criteria to the strategy of crossing moving averages analyzed in previous articles:

Fixed Size: This method is probably the most typical when developing a trading strategy. The rule consists of applying a fixed volume per trade. For example, consider the position size of 0.1 lot per trade, the code for our strategy is as follows:

extern double TradeSize = 0.1;

   //Open Buy Order, instant signal is tested first
   if(Cross(0, iMA(NULL, PERIOD_CURRENT, Period1, 0, MODE_LWMA, PRICE_CLOSE, 0) >
 iMA(NULL, PERIOD_CURRENT, Period2, 0, MODE_SMA, PRICE_CLOSE, 0))
 //Moving Average crosses above Moving Average
   )
     {
      RefreshRates();
      price = Ask;
      SL = SL_Pips * myPoint; //Stop Loss = value in points (relative to price)   
      if(IsTradeAllowed())
        {
         ticket = myOrderSend(OP_BUY, price, TradeSize, "");
         if(ticket <= 0) return;
        }
      else //not autotrading => only send alert
         myAlert("order", "");
      myOrderModifyRel(ticket, SL, 0);
     }
   
   //Open Sell Order, instant signal is tested first
   if(Cross(1, iMA(NULL, PERIOD_CURRENT, Period1, 0, MODE_LWMA, PRICE_CLOSE, 0) <
 iMA(NULL, PERIOD_CURRENT, Period2, 0, MODE_SMA, PRICE_CLOSE, 0))
 //Moving Average crosses below Moving Average
   )
     {
      RefreshRates();
      price = Bid;
      SL = SL_Pips * myPoint; //Stop Loss = value in points (relative to price)   
      if(IsTradeAllowed())
        {
         ticket = myOrderSend(OP_SELL, price, TradeSize, "");
         if(ticket <= 0) return;
        }
      else //not autotrading => only send alert
         myAlert("order", "");
      myOrderModifyRel(ticket, SL, 0);

Percentage of Risk per Trade: this criterion considers the account’s size given the account’s capital and estimates the stop loss distance needed to execute the trade according to the devised strategy. The common practice is to risk 1% of the equity currently available in the trading account. In this case, the implementation of the strategy is as follows:

double MM_Percent = 1;
double MM_Size(double SL) //Risk % per trade, SL = relative Stop Loss to
 calculate risk
  {
   double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT);
   double MinLot = MarketInfo(Symbol(), MODE_MINLOT);
   double tickvalue = MarketInfo(Symbol(), MODE_TICKVALUE);
   double ticksize = MarketInfo(Symbol(), MODE_TICKSIZE);
   double lots = MM_Percent * 1.0 / 100 * AccountBalance() /
 (SL / ticksize * tickvalue);
   if(lots > MaxLot) lots = MaxLot;
   if(lots < MinLot) lots = MinLot;
   return(lots);
  }

Position Sizing to Equity: this method executes the trading order according to the trading account’s equity. For example, the developer could place one lot per $100,000 in the trading account. This method will increase or reduce each transaction’s volume as the capital of the trading account evolves.

extern double MM_PositionSizing = 100000;
double MM_Size() //position sizing
  {
   double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT);
   double MinLot = MarketInfo(Symbol(), MODE_MINLOT);
   double lots = AccountBalance() / MM_PositionSizing;
   if(lots > MaxLot) lots = MaxLot;
   if(lots < MinLot) lots = MinLot;
   return(lots);
  }

There are other methods, such as martingale and anti-martingale, discussed in a forthcoming educational article. For now, we present your definition.

  • Martingale: this rule is based on the money management of gambling. This method doubles the position size after each losing trade and starts at one position after each win. This method is extremely dangerous and should be avoided.
  • Anti-Martingale: this method opposes martingale, that is, doubles the position size after each winning trade and starts with a position after a losing trade. This method plays with what the trader considers to be “market’s money.” It is advisable to reset the size after a determined number of steps since the logic bets on a winning streak, which will end at some point. A 3-step is good enough to increase profits substantially. 4-step may be an absolute maximum on most trading strategies.

Conclusions

Position sizing is one of the critical decisions that the trading strategy developer must make. This choice will influence both the trading account’s growth and the capital risk to be exposed in each trade.

On the other hand, we have seen three examples of position sizing, representing a criteria guide that the trading strategy developer can use.

Finally, the developer of the trading strategy should explore and evaluate which is the best option of position sizing to use, taking into account the benefits of each of the impacts on the strategy’s execution.

Suggested Readings

  • Jaekle, U., Tomasini, E.; Trading Systems: A New Approach to System Development and Portfolio Optimisation; Harriman House Ltd.; 1st Edition (2009).
  • Pardo, R.; The Evaluation and Optimization of Trading Strategies; John Wiley & Sons; 2nd Edition (2008).
970x250

By Eduardo Vargas

Eduardo Vargas is a technical analyst and independent trader based in Buenos Aires, Argentina. He is an Industrial Engineer and holds a Master in Finance degree. In 2008 began to trade Chilean stocks listed on IPSA. From 2013 started to trade CFDs on Forex, Commodities, Indices and ETFs markets. He analyses different markets combining the Elliott Wave analysis with Fibonacci tools. He provides a market mid-long-term vision.

Leave a Reply

Your email address will not be published. Required fields are marked *