Trend Following And Momentum On Bitcoin – Capturing The Trend (Amibroker And Tradestation Code)

The strategy can be found here.

 

The strategy in plain English:

 

We present several strategies for bitcoin:

Strategy 1:

  1. Buy at the close if the close breaks above the 20-day simple moving average.
  2. Sell at the close if the close breaks below the 20-day simple moving average.

 

Strategy 2:

  1. Construct two simple moving averages: one short of 100 days and one long of 250 days.
  2. When the short moving average closes above the long moving average, go long at the close.
  3. When the short moving average closes below the long moving average, sell at the close.

 

Strategy 3:

 

  1. If the close is higher than the close 25 days ago, go long at the close.
  2. If the close is lower than the close 25 days ago, sell at the close.

 

Click here for the original article.

 

Amibroker code:

 

The code is like this in chronological order:

Buy = C > EMA(C,20);
buyPrice = Close;
Sell = C < EMA(C,20);
sellPrice = C ;

 

Buy = MA(C,100) > MA(C,250);
buyPrice = Close;
Sell = MA(C,100) < MA(C,250);
sellPrice = C ;

 

Buy = C > Ref(C,-25);
buyPrice = Close;
Sell = C < Ref(C,-25);
sellPrice = C ;

 

Tradestation code:

 

If c > average(close,20)

then buy this bar at c;

If c < average(close,20)

then sell this bar at c;

 

If average(close,100) > average(close,250)

then buy this bar at c;

If average(close,100)< average(close,250)

then sell this bar at c;

 

If c > c[25] then buy this bar at c;

If c < c[25] then buy this bar at c;

 

Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.