Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- strategy("VPLS v.1",overlay=false)
- k = sma(stoch(close, high, low, 5), 1)
- d = sma(k, 1)
- stochbullish = (k > k[1])
- stockbearish = (k < k[1])
- maa = input(28)
- rsii = input(5)
- lowr = input(1)
- x1 = close > sma(close,200)
- x2 = close < close[1]
- //x3 = rsi(close,2)[1] < rsii and rsi(close,2) > lowr
- x3 = rsi(close,2) < 2
- x4 = close > sma(close,maa)
- BodyTop = max(open,close)
- BodyBot = min(open,close)
- BodySize = BodyTop - BodyBot
- BodyAvg = ema(BodySize,20) * 2
- long = x1 and x2 and x3 and x4 and stochbullish and volume < volume[1] //and BodySize > BodyAvg
- bgcolor(long ? green:na,transp=0)
- z1 = close < sma(close,200)
- z2 = close > close[1]
- //z3 = rsi(close,2)[1] > 95 and rsi(close,2) < 99
- z3 = rsi(close,2) > 98
- z4 = close < sma(close,maa)
- short = z1 and z2 and z3 and z4 and stockbearish and volume < volume[1] //and BodySize > BodyAvg
- bgcolor(short ? red:na,transp=0)
- //bgcolor(short ? red:na,transp=0)
- //plot(sma(close,200),color=orange,linewidth=3,transp=0)
- //plot(sma(close,3),color=green,linewidth=1,transp=0)
- sell = (close > sma(close,3) or close > open)
- //strategy.entry("buy", true, when = long)
- //strategy.close("buy", when = sell)
- strategy.order("long", true, 1000,when = long )
- strategy.order("long", true, 3000,when = long[1] and open > close)
- //strategy.exit("exit", "long",when = close > sma(close,3))
- //strategy.close_all(when = close > sma(close,3))
- //strategy.entry("buy", true, when = open > close)
- //strategy.close("buy", when = open < close)
- //////////strategy.close_all( (long[1] or (long[1] and open > close)[1] ) and close > sma(close,3))
- strategy.close("long" , when = close > sma(close,3))
- strategy.entry("short", false,1000, when = short )
- strategy.entry("short", false,3000, when = short[1] and open < close)
- strategy.close("short" , when = close < sma(close,3))
- //strategy.close("short", when = short[1] and open > close)
- ///////strategy.close_all( (short[2] or (short[1] and open < close)[1] ) and close < sma(close,3))
- plot(strategy.equity)
Advertisement
Add Comment
Please, Sign In to add comment