SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //@version=4
  2. strategy(title="Prove it", shorttitle="DPO", format=format.price, precision=2)
  3. period_ = input(350, title="Period", minval=1)
  4. slow_ema = input(100, title="Short EMA", minval=1)
  5. long_ema = input(125, title="Long EMA", minval=1)
  6. barsback = period_/2 + 1
  7. ma = sma(close, period_)
  8. dpo = close - ma[barsback]
  9. // plot(dpo, offset = 0, title="DPO", color=color.olive)
  10. hline(0, title="Zero")
  11.  
  12.  
  13. plot(ema(dpo, slow_ema), color=color.green)
  14. plot(ema(dpo, long_ema), color=color.red)
  15.  
  16. ema1 = ema(dpo, slow_ema)
  17. ema2 = ema(dpo, long_ema)
  18.  
  19. long = crossunder(ema2, ema1)
  20. short = crossunder(ema1, ema2)
  21.  
  22. if long
  23.     strategy.entry("Long", strategy.long, comment="Long")
  24.  
  25. if short
  26.     strategy.entry("Short", strategy.short, comment="Short")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top