Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- strategy(title = "crocodile", shorttitle = "crocodile", overlay = true, default_qty_type = strategy.fixed, initial_capital=10000, currency="USD", default_qty_value = 1)
- timescale = (time > timestamp(2018, 1, 1, 00, 00) and time < timestamp(2100, 12, 31, 00, 00))
- //Logic
- sub_hlc3=security("BITFLYER:FXBTCJPY","30",hlc3)
- sub_close=security("BITFLYER:FXBTCJPY","30",close)
- sub_open=security("BITFLYER:FXBTCJPY","30",open)
- up = rma(max(change(hlc3), 0), 6)
- down = rma(-min(change(hlc3), 0), 6)
- udCal(up, down) =>
- if down == 0
- 100
- if up == 0
- 0
- else
- 100 - (100 / (1 + up / down))
- fastrsi = udCal(up, down)
- sub_up = rma(max(change(sub_hlc3), 0), 6)
- sub_down = rma(-min(change(sub_hlc3), 0), 6)
- sub_udCal(sub_up, sub_down) =>
- if sub_down == 0
- 100
- if sub_up == 0
- 0
- else
- 100 - (100 / (1 + sub_up / sub_down))
- sub_fastrsi = sub_udCal(sub_up, sub_down)
- Buy_IN = close<open and abs(close - open) > ema(abs(close - open), 5)*1.1 and sma(fastrsi,4)<18
- Sell_IN = open<close and abs(close - open) > ema(abs(close - open), 5)*1.1 and sma(fastrsi,4)>82
- Close = (strategy.position_size > 0 and fastrsi > 20 ) or (strategy.position_size < 0 and fastrsi < 80 )
- sub_Buy_IN = sub_close<sub_open and abs(sub_close - sub_open) > ema(abs(sub_close - sub_open), 5)*1.1 and sma(sub_fastrsi,4)<18
- sub_Sell_IN = sub_open<sub_close and abs(sub_close - sub_open) > ema(abs(sub_close - sub_open), 5)*1.1 and sma(sub_fastrsi,4)>82
- if Buy_IN and sub_Buy_IN
- strategy.entry("BUY", strategy.long, na, when=timescale)
- if Sell_IN and sub_Sell_IN
- strategy.entry("SELL", strategy.short, na, when=timescale)
- if Close
- strategy.close_all()
Add Comment
Please, Sign In to add comment