Guest User

Untitled

a guest
Jul 15th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. //@version=3
  2. strategy(title = "crocodile", shorttitle = "crocodile", overlay = true, default_qty_type = strategy.fixed, initial_capital=10000, currency="USD", default_qty_value = 1)
  3. timescale = (time > timestamp(2018, 1, 1, 00, 00) and time < timestamp(2100, 12, 31, 00, 00))
  4. //Logic
  5. sub_hlc3=security("BITFLYER:FXBTCJPY","30",hlc3)
  6. sub_close=security("BITFLYER:FXBTCJPY","30",close)
  7. sub_open=security("BITFLYER:FXBTCJPY","30",open)
  8. up = rma(max(change(hlc3), 0), 6)
  9. down = rma(-min(change(hlc3), 0), 6)
  10. udCal(up, down) =>
  11. if down == 0
  12. 100
  13. if up == 0
  14. 0
  15. else
  16. 100 - (100 / (1 + up / down))
  17. fastrsi = udCal(up, down)
  18.  
  19. sub_up = rma(max(change(sub_hlc3), 0), 6)
  20. sub_down = rma(-min(change(sub_hlc3), 0), 6)
  21. sub_udCal(sub_up, sub_down) =>
  22. if sub_down == 0
  23. 100
  24. if sub_up == 0
  25. 0
  26. else
  27. 100 - (100 / (1 + sub_up / sub_down))
  28. sub_fastrsi = sub_udCal(sub_up, sub_down)
  29.  
  30. Buy_IN = close<open and abs(close - open) > ema(abs(close - open), 5)*1.1 and sma(fastrsi,4)<18
  31. Sell_IN = open<close and abs(close - open) > ema(abs(close - open), 5)*1.1 and sma(fastrsi,4)>82
  32. Close = (strategy.position_size > 0 and fastrsi > 20 ) or (strategy.position_size < 0 and fastrsi < 80 )
  33. 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
  34. 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
  35.  
  36. if Buy_IN and sub_Buy_IN
  37. strategy.entry("BUY", strategy.long, na, when=timescale)
  38. if Sell_IN and sub_Sell_IN
  39. strategy.entry("SELL", strategy.short, na, when=timescale)
  40. if Close
  41. strategy.close_all()
Add Comment
Please, Sign In to add comment