Calculate Z-score in combination with DCA

Hi,

For our trading bot we are trying to integrate the following stuff:

  • Z-score
  • Sharpe ratio
  • Sortino ratio

The problem we have is that we use the double down strategy (rebuy more stocks if the price drops x % at the moment our tool indicators tell us that we have a high performance to win the new trade). Because of this strategy we don’t have the losing numbers we need in the calculation. Hope someone can help us with this part:

Concrete we like to use this formula:

Z = [N x (R – 0.5) – P] / [(P x (P – N)] / (N – 1)]½

When:

N is the total number of trades during a series;
R is the total number of series of winning and losing trades;
P equals 2 x W x L
W is the total number of winning trades during a series
L is the total number of losing trades during a series

Problem is we dont have losing trades (continue rebuy, dont use a stoploss)

Anyone has a solution how we can fix this?

You method is called “Martingale”. The key with martingale, when applied to trading, is that by “doubling down” you essentially lower your average entry price. In the example below, at two lots, you need the EUR/USD to rally from 1.263 to 1.264 to break even. As the price moves lower and you add four lots, you only need it to rally to 1.2625 instead of 1.264 to break even. The more lots you add, the lower your average entry price. Even though you may lose 100 pips on the first lot of the EUR/USD if the price hits 1.255, you only need the currency pair to rally to 1.2569 to break even.

@micasa001 maybe try to describe what you want to achieve with formula for Z above.
It looks like you’re having a position based strategy, where you treat multiple trades as single position. If you are ready to average down until your margin is cleaned - you won’t make use of such statistical metrics, as your strategy will work until it won’t - and it means blowing the account :slight_smile:
You can also implement something like stop loss for whole position - open n trades to average and accept loss at some stage. Then you will have material to go with probability and expectation metrics.