SAR and Price High and Low Strategy

Strategy Name: SAR and Price High and Low Strategy

Data cycle: 1H, etc.

Strategic Support: Commodity Futures, Digital Currency Spot, Digital Currency Futures

(*backtest
start: 2018-01-01 00:00:00
end: 2018-12-02 00:00:00
period: 1d
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
args: [["IsCryptoCurrency",2],["ContractType","rb888",126961]]
*)

LOTS:=IF(IsCryptoCurrency, IF(IsCryptoCurrency=1, CryptoCurrencyTradeAmount, MAX(1, INTPART(CryptoCurrencyTradeAmount))), MAX(1,INTPART(MONEYTOT/(O*UNIT*0.1))));
SARLINE:=SAR(4,2,20);

B1:=SARLINE>0;
S1:=SARLINE<0;
B2:=HIGH>=HHV(CLOSE,N);
S2:=LOW<=LLV(CLOSE,N);

BUYK:=BARPOS>N AND B1 AND B2;
SELLK:=BARPOS>N AND S1 AND S2;
SELLY:=S1 AND S2 AND BKHIGH>BKPRICE*(1+0.01*SLOSS);
BUYY:=B1 AND B2 AND SKLOW<SKPRICE*(1-0.01*SLOSS);
SELLS:=C<BKPRICE*(1-SLOSS*0.01);
BUYS:=C>SKPRICE*(1+SLOSS*0.01);
BUYK,BK(LOTS);
SELLK,SK(LOTS);
SELLY,SP(BKVOL);
BUYY,BP(SKVOL);
SELLS,SP(BKVOL);
BUYS,BP(SKVOL);

Backtest on FMZ Quant to know more

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

Add a Comment

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