Strategy idea: Use double average lines to determine the direction;

                          use the DDI indicator to determine when to open position;

                          proportional to determine the stop loss and take profit

Data cycle: 15 minutes


  • Indicators in main chart:
    VAR2^^MA(C, PARAM2);
    VAR3^^MA(VAR2, PARAM1);
  • Indicators in secondary chart:
    VAR9: MA (VAR8, 2*PARAM1);
    VAR10: MA (VAR9, PARAM1);
    VAR8: VAR6-VAR7;
(*backtest
start: 2018-11-01 00:00:00
end: 2018-12-14 00:00:00
period: 15m
exchanges: [{"eid":"Futures_BitMEX","currency":"XBT_USD"}]
args: [["TradeAmount",100,126961],["ContractType","XBTUSD",126961]]
*)

VAR2^^MA(C,PARAM2);
VAR3^^MA(VAR2,PARAM1);

VAR4:=IFELSE((HIGH+LOW)<=(REF(HIGH,1)+REF(LOW,1)),0,MAX(ABS(HIGH-REF(HIGH,1)),ABS(LOW-REF(LOW,1)))),NODRAW;
VAR5:=IFELSE((HIGH+LOW)>=(REF(HIGH,1)+REF(LOW,1)),0,MAX(ABS(HIGH-REF(HIGH,1)),ABS(LOW-REF(LOW,1)))),NODRAW;
VAR6:=SUM(VAR4,PARAM1)/(SUM(VAR4,PARAM1)+SUM(VAR5,PARAM1)),NODRAW;
VAR7:=SUM(VAR5,PARAM1)/(SUM(VAR5,PARAM1)+SUM(VAR4,PARAM1)),NODRAW;
VAR8:VAR6-VAR7;
VAR9:MA(VAR8,2*PARAM1);
VAR10:MA(VAR9,PARAM1);

BUYK:=BARPOS>PARAM2 AND C>VAR2 AND VAR2>VAR3 AND VAR8>0 AND VAR9>VAR10;
SELLK:=BARPOS>PARAM2 AND C<VAR2 AND VAR2<VAR3 AND VAR8<0 AND VAR9<VAR10;

SELLY:=C<VAR2 AND C>BKPRICE*(1+0.01*PARAM3);
BUYY:=C>VAR2 AND C<SKPRICE*(1-0.01*PARAM3);

SELLS:=C<BKPRICE*(1-PARAM3*0.01);
BUYS:=C>SKPRICE*(1+PARAM3*0.01);

BKVOL=0 AND BUYK,BK;
SKVOL=0 AND SELLK,SK;

SELLS,SP(BKVOL);
BUYS,BP(SKVOL);

SELLY,SP(BKVOL);
BUYY,BP(SKVOL);

Backtest on FMZ Quant to know more

Source Codehttps://www.fmz.com/strategy/128133

Leave a Reply

Your email address will not be published. Required fields are marked *