Once you have a system that looks profitable and robust , you now need to create a tradeplan around it. Let’s consider a basket trading system. Our question is based on the current account balance how many contracts of each market should we trade in order to have proper risk management. In order to solve this problem I develop a simple but powerful concept called Dynamic margin. We will show this concept in this article using TradersStudio to calculate this.
First, allow me to start with the general idea:
Dynamic Margin = (Average(Range,40) * 7) * Bigpointvalue
Where “Bigpointvalue” is value of a big point, for example 1000 in bonds and crude, and 50.00 for a S&P500 e-mini contract. While exchange margins tend to be very slow to update, I invented this term so that my strategies can decide how many lots to buy dynamically without needing the actual exchange margin information.
Consider the following code example:
' TradersStudio(r) (c) 2006-2007 all rights reserved
Dim M As Integer
Dim S As Integer
TradePlan.Session(0).UnitSize = 1
‘ For each session Loop though the trading plans.
For S=0 To TradePlan.SessionCount-1
For M = 0 To TradePlan.Session(S).MarketCount – 1
If DollarsPerMarket>DynMargin Then
If (DollarsPerMarket*Percent/100)/ DynMargin>=1 Then
TradePlan.Session(S).Market(M).EntryNumUnits =Min(Floor((DollarsPerMarket*Percent/100)/ DynMargin),Ceiling)
Else If (DollarsPerMarket*Percent/100)/ DynMargin>.7 Then
Function DynamicMargin(mkt As TSProcessor.IMarket,LBPeriod,MARGINEST)
Dim Arr As Array
Arr = mkt.DataArray(0, “TrueRange”)
For I = 0 To LBPeriod-1
Typically with this code, I use 40 for the range moving average and 7 for marginest. Using these parameters will give approximately 2X the normal margins. In other words, we can use TradersStudio to get the optimal number of contracts to purchase (EntryNumUnits) based on our buying ability.
This is a short example on how we can use this software in different ways. Oftentimes articles are very focused on strategies, but this concept of dynamic margins is an important one. After all, a strategy that cannot maximize the use of your money cannot return you maximum profits.