You need to enable JavaScript in order to visit our site!
 
Logo PTMC
NAVIGATION
CANCEL
 
or via PTMC account
Restore password
or via PTMC account
Logo PTMC
NAVIGATION
or via PTMC account
Restore password
or via PTMC account
or via PTMC account
Restore password
or via PTMC account
PTMC team 23.10 2014

Practical example of using DDE in Protrader

Hey there, Protraders!

Continuing the topic of risk management we will consider an example of the organization of discrete intraday trading on the futures S&P in today’s article. As already mentioned in the previous article in the case of automated trading all statistics can be tracked inside a trading robot that ensures the compliance of the clear rules of risk management. But if we are talking about a discrete trading based, for example, on the elements of technical analysis, then function of risk management falls entirely on the trader’s shoulders. Different external factors affect the trader during the trading which can lead to a mistake in calculation or trading decision dictated by emotions, it all belongs to the so-called operational risks which need to be minimized. Maximal automation of computing processes gives a possibility to reduce the operational risks. One of the solutions to reduce operational risks is dynamic tracking of specified trade parameters in the electronic table Excel. Data export function using DDE mechanism (Dynamic Data Exchange) is provided for this in the Protrader terminal. Of course, the parameters which need to be tracked in this case are pretty individual and depend on trading system and assets used in it.

Let’s simulate the work of intraday trader. Trading will be conducted by one asset, namely futures S&P. Let the trading system provides opening of one position. Fixation of the loss or profit is made by some signals of the trading system. Specified percent threshold of maximum possible losses per trading day will be used as one of the risk management rules. Trading stops when this value is reached. This rule will simultaneously protect the trading account from large losses due to a long series of losses and give a possibility to reinvest earned funds, since account balance at the opening of trading day will be included to the calculation of the working lot. It will be also required to set safe Stop loss and Take profit larger than the average daily volatility of the asset to protect the trading account from the extremely volatile index movements. Open the “Accounts” page at the beginning of the trading day on which the information by trading accounts will be displayed.

open accounts page

open accounts page.

In order to export these data to the electronic table Excel, select item “Export -> To Excel…” in the context menu.

In order to export these data to the electronic table Excel, select item “Export - To Excel…” in the context menu.

Choose the needed parameters of the trading account in the export menu and activate the synchronization.

Choose the needed parameters of the trading account in the export menu and activate the synchronization.

Having done the above mentioned actions we will receive the electronic table with data about trading accounts:

Having done the above mentioned actions we will receive the electronic table with data about trading accounts

Futures’ trading is available from the account EXCH-3325, and its parameters in particular are interested for us. Let’s decipher the exported data:

  • Balance – the trading account balance;
  • Open net P/L – current liquidation cost of opened positions;
  • Margin used, % – the percentage of involved margin;
  • Available funds – “free” funds on the account;
  • Today’s fees – sum of the fees paid per trading day;
  • Today’s net – financial result of the trades per trading day;
  • Margin used – the involved margin.

To execute the rule of not exceeding the specified threshold of the losses per one trading day, let’s perform simple calculation in the same spreadsheet. Let’s input parameter “Trading is allowed” which will allow or prohibit opening of the next trade. The calculation formula of this parameter is as follows:

If (Risk cash >Today’s loss; "Yes"; "No")

where,

Risk cash = % Day risk × Start of day balance;

% Day risk – the percentage of risk capital;

Start of day balance – balance of the trading account on the day’s opening; the parameter which is fixed by trader before starting the work and is numerically equal to the value in the row “Balance” till starting the trading.

Today’s loss – losses received during the working day; are numerically equal to the Today’s net, if it below 0.

Today’s net – financial result of the trading day.

Thus, the parameter “Trading is allowed” will be set to “Yes”, in the case if the threshold value of losses per trading day isn’t exceed and trading is allowed. When value is set to “No”, the trading must be stopped till next trading day.

the parameter “Trading is allowed” will be set to “Yes”, in the case if the threshold value of losses per trading day isn’t exceed and trading is allowed.

In the current example, let’s take the threshold value of losses per trading day equal to 5% from trading account balance on the day’s opening. Parameter “Trading is allowed” is set to “Yes” – trading is allowed.

We need to define the volume of the working position on the next step so that during the implementation of unfavorable situation (activation of the protective Stop loss) the trading account balance isn’t reduced by the amount greater than specified risk threshold (“Risk cash”). Let’s set the values of safe Stop loss and Tale profit, they will be equal, and are defined from the average daily volatility value of the asset. Let’s take it equal to 20 ticks for our example. On this basis, we can determine the volume of the working position by the following formula:

Lot = Rounddown (Actual risk cash / (Stop Loss / min. tick × Tick value);1 )

where, Rounddown – rounding function of the obtained value to nearest lower value with specified digit capacity;

Actual risk cash = Risk cash + Today’s loss;

  • Actual risk cash – the current value of risky funds taking into account the possible negative results of intraday trading;
  • Stop loss – safe value in ticks;
  • Min tick – minimal possible tick value;
  • Tick value – the value of the minimal tick.

Actual risk cash = Risk cash + Today’s loss;

DDE.rar

Thus, using export to Excel and simple formulas we have defined the optimal position size for chosen intraday trading system at the same time protecting account not only from large lossesdue to long series of losing trades in the unfavorable days, but also from unpredictable volatile movements of the asset. Also this simple approach allows reinvesting daily the obtained profit so that profit earned for the previous trading day will be included in the calculation of the position volume. Created electronic table will warn about exceeding the threshold of losses during the trading day and protect trader from emotional trades aimed at reducing the already incurred losses. So the possibility of operational risk in the form of the manual calculation error of opened position volume is reduced.

Data from the “Positions”, “Order book”, “Account details” windows can be exported in a similar manner.

Data from the “Positions”, “Order book”, “Account details” windows can be exported in a similar manner

Based on the obtained data in the “Real time” mode we can track the parameters of opened trades and using them to calculate different derivative statistics which can help to control the risks. Margin parameters of the separate trades and the portfolio as a whole, the serial of losses and profits, the indicators that show the relationship of assets in the portfolio, and many others can be attributed to this important data.

Discussion
Join PTMC community to post your comments
No comments yet. Be the first.
PTMC is a professional trading platform that combines all the best charting and analytical tools to trade on different financial markets. It is developed by PFSOFT UK LTD, a global provider of trading technology for banks & brokers
© 2017. PTMC is based on Protrader technology
Head office
PFSOFT UK LTD
20 Centenary Avenue
South Shields, Tyne and Wear,
NE34 6QH
United Kingdom
Ukraine office
TOV PTMC
26, Naberezhna str., Dnipro,
Dnipropetrovs'k region,
Ukraine
Contact us
Phone: +380 56 740 30 01
E-mail: info@protrader.org
Skype: PTMC_support
Social groups