Trademinator selling and buying algorithm will not sell 100% of your balance in the first spot. Because you do not know what will happen in the future, the algorithm plays safe and it sells in a proportion of n / (n + 1) with a correction factor. Although this could be very good and profitable if the price is not bearing, when it is, it could harm as you are carrying a balance with a greater buying rate than the current one. This document proposes a double average as a solution.

The double average means using the last 4 periods of orders (2 sells, 2 buys). The following formula shows the way to calculate the balanced buying average between two periods B1 and B2.

B = ((VS1 - VB1) * B1 + VB2 * B2) / (VS1 - VB1 + VB2)

Where:

  • B is the balanced buying average
  • V means the volume of YYY units
  • S means a selling rate of XXX/YYY
  • B means a buying rate of XXX/YYY
  • 1 or 2 are the periods behind

The following cases explain more carefully.

Some hard rules to remember:

  • Trademinator will only sell if the last average buying price is lower than the current selling price. In other words, it will seel if Bn < S. 

Case 1: Neutral Trend

trading graph 1

The following conditions are met:

  • B1 < S1
  • B1 > B2
  • B1 < S2
  • S1 > S2
  • B2 < S2

There is no need to use a double average as B2 is less than B1, it will average down any remaining balance not sold by S1.

Case 2: Bearing Trend

trading graph 2

The following conditions are met:

  • B1 < S1
  • B1 > B2
  • B1 > S2
  • S1 > S2
  • B2 < S2

The double average is needed. Because B1 > S2, any remaining balance not sold in S1 needs to be average with B2. S2 can only happen if it is greater than the balanced average between B1 and B2 balances.

Case 3: Bullying Trend

trading graph 3

The following conditions are met:

  • B1 < S1
  • B1 < B2
  • B1 < S2
  • S1 < S2
  • B2 < S2

There is no need to use a double average. The balanced average between B1 and B2 will be less than B2 then S2 will take place if the average of B1 and B2 which it is the same as comparing against B2.

Status

  • Partial implementation in 0.3.0

About

Trademinator is an opensource trading bot that works in a SaaS scheme.

Trademinator is powered by Linux, PHP, Memcached, YAML