SHARE
TWEET

Bollinger Oscillator Dif v2

memer1952 Sep 22nd, 2019 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //@version=3
  2. strategy(title="Bollinger Oscillator Dif", shorttitle="B-Osc dif", precision=2)
  3.  
  4. //inputs
  5. length = input(4)
  6. mult = input(1.0)
  7. thresh = input(100,title="thresh")
  8.  
  9. //formulas
  10. Bollinger_Oscillator = ((close - sma(close, length)) / ((sma(close, length) + mult * stdev(close, length))-(sma(close, length) - mult * stdev(close, length))) * 2) * 100
  11.  
  12. dif = Bollinger_Oscillator - Bollinger_Oscillator[1]
  13.  
  14. rsi = rsi(close,2)
  15. rsi_dif = rsi - rsi[1]
  16. thrust = rsi_dif > 50
  17.  
  18. //
  19.  
  20. //
  21. signal = dif > thresh  //and (not thrust)
  22.  
  23. //presets
  24. bgcolor(signal ? red:na,transp=0)
  25.  
  26. plot(dif,transp=0,color=black)
  27.  
  28.  
  29. strategy.entry("short", false,1000, when = signal)  
  30. strategy.entry("short", false,3000, when = signal[1] and open < close)
  31.  
  32. strategy.close("short", when = signal[1] and open > close)
  33. strategy.close_all(when = signal[2])
  34.  
  35.  
  36.  
  37.  
  38.  
  39. //
  40. //thresh1 = input(-100,title="thresh")
  41.  
  42. //buy = dif < thresh1
  43. //strategy.entry("buy", false,1000, when = buy)  
  44. //strategy.entry("buy", false,3000, when = buy[1] and open > close)
  45.  
  46. //strategy.close("buy", when = buy[1] and open < close)
  47. //strategy.close_all(when = buy[2])
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top