Bitcoin Tripple MA Miner 1Min

Category: Strategies By: juanj Created: May 27, 2017, 8:38 AM
May 27, 2017, 8:38 AM
Strategies
26 Comments

Good Day

So a about a week ago I got the idea to code a strategy to exclusively trade XBTUSD (Bitcoin). The idea was to write an algorithm that will keep up with the tremendous bullish momentum of the price while reducing drawdown compared to a buy and hold strategy, but at the same time to be ready to short the hell out of it when things start going south! So yesterday I finally got to see it in action as we saw a minor crash and the result was simply glorious!

The strategy is actually quite simple as it is primarily based around 3 moving averages (5 minutes apart) along with a ADX check for volatility.

//Bitcoin Tripple MA Miner 1Min
//Author: Juan Jacobs
//Exchange: XBTUSD Mini
//Timeframe: 1Min
//Spread: 10 or 20

DEFPARAM FLATBEFORE = 100000 //Adjust for your timezone (currently set for GMT+2)
DEFPARAM FLATAFTER = 230000 //Adjust for your timezone (currently set for GMT+2)

FMA = Average[12,4](close) //Fast Moving Average
MMA = Average[17,4](close) //Medium Moving Average
SMA = Average[22,4](close) //Slow Moving Average

stp = 2 //Points away to place stop orders

If hour < 10 or hour > 23 then //Adjust to match Flat Before/After
 possize = 0
 If longonmarket then
  SELL AT MARKET
 ElsIf shortonmarket then
  EXITSHORT AT MARKET
 EndIf
Else
 If ADXR[14] > 18 Then //Check for enough volatility
possize = 1
 Else
  possize = 0
 EndIf
EndIf

If countofposition  = 0 or shortonmarket and FMA > MMA and MMA > SMA Then
 If shortonmarket then
  If close > close[3] and close > close[5] Then
   Exitshort at market
   Buy possize contract at open - stp stop
  EndIf
 Else
  Buy possize contract at open - stp stop
 EndIf
ElsIf countofposition = 0 or Longonmarket and FMA < MMA and FMA < SMA Then
 If longonmarket then
  If close < close[3] and close < close[5] Then
   Sell AT MARKET
   Sellshort possize contract at open + stp stop
  EndIf
 Else
  Sellshort possize contract at open + stp stop
 EndIf
EndIf

SET STOP $LOSS 100*possize
SET TARGET $PROFIT 1500*possize

Download
Filename: Bitcoin-Miner.jpg
Downloads: 138
Download
Filename: Bitcoin-last-7-sessions.jpg
Downloads: 197
Download
Filename: Bitcoin-Tripple-MA-Miner-1Min.itf
Downloads: 567
juanj Master
My name is Juan Jacobs and I am an algorithmic trader and trading coach. After 7 years of corporate work as a Systems Analyst, I have decided to pursue my passion of trading on a full-time basis. My current focus area is that of 'smart' strategies based on 'Machine Learning'. You can find me at www.FXautomate.com or visit my PRC Marketplace Store here: https://market.prorealcode.com/store/fxautomate/
Author’s Profile

Comments

Logo Logo
Loading...