Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © Maurizio-Ciullo
- //@version=5
- strategy(title='Indicatore Stocastico Per Strategie V5', overlay=true, precision = 2,
- pyramiding=0,
- initial_capital=150,
- commission_type=strategy.commission.percent,
- commission_value=0.1,
- slippage=3,
- default_qty_type=strategy.percent_of_equity,
- default_qty_value=46)
- // Start Detecting Stocastico ///////////////////////////////////////////////////////
- periodK = input.int(14, title="%K Length", minval=1)
- smoothK = input.int(1, title="%K Smoothing", minval=1)
- periodD = input.int(3, title="%D Smoothing", minval=1)
- k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)
- d = ta.sma(k, periodD)
- plot(k, title="%K", color=#2962FF)
- plot(d, title="%D", color=#FF6D00)
- h0 = hline(80, "Upper Band", color=#787B86)
- hline(50, "Middle Band", color=color.new(#787B86, 50))
- h1 = hline(20, "Lower Band", color=#787B86)
- fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background")
- // End Detecting Stocastico ///////////////////////////////////////////////////////
- //entrata e uscita Long (stop/limit x prezzo) (loss/profit x ticks)
- if strategy.opentrades == 0 and k > 80
- strategy.entry('operazioneLong', strategy.long, alert_message = "Open Long Position")
- if strategy.opentrades == 1 and k < 7
- strategy.close(id='operazioneLong', alert_message = "Close Long Position")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement