Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- // This Pine Scriptโข code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // ยฉ rabiha_
- //23.1 dran weiterarbeiten
- import EliCobra/CobraMetrics/4 as cobra
- //// PLOT DATA
- disp_ind = input.string ("None" , title = "Display Curve" , tooltip = "Choose which data you would like to display", options=["Strategy", "Equity", "Open Profit", "Gross Profit", "Net Profit", "None"], group = "๐ ๐๐ธ๐ซ๐ป๐ช ๐๐ฎ๐ฝ๐ป๐ฒ๐ฌ๐ผ ๐")
- pos_table = input.string("Middle Left", "Table Position", options = ["Top Left", "Middle Left", "Bottom Left", "Top Right", "Middle Right", "Bottom Right", "Top Center", "Bottom Center"], group = "๐ ๐๐ธ๐ซ๐ป๐ช ๐๐ฎ๐ฝ๐ป๐ฒ๐ฌ๐ผ ๐")
- type_table = input.string("None", "Table Type", options = ["Full", "Simple", "None"], group = "๐ ๐๐ธ๐ซ๐ป๐ช ๐๐ฎ๐ฝ๐ป๐ฒ๐ฌ๐ผ ๐")
- plot(cobra.curve(disp_ind))
- cobra.cobraTable(type_table, pos_table)
- strategy(title="STC", shorttitle="Stoch", format=format.price, precision=2, overlay = true, initial_capital = 100000, slippage = 1,pyramiding = 1, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
- //Time Range
- startDate = input.time(defval = timestamp( "01 january 2018"), title= "Start Date", group = "Date period")
- //STC ////conditions////
- //longCondition= A and/or B and/or C
- //shortCondition= A and/or B and/or C
- /////Entry conditions////
- longCondition = ta.stoch(close, high, low, STCFastLengh, 3) < 20
- shortCondition = ta.stoch(close, high, low, STCSlowLengh, 3) > 80
- //Enter long position//
- if (longCondition and time >= startDate and barstate.isconfirmed)
- strategy.entry("long", strategy.long)
- //Enter short position
- if (shortCondition and time >= startDate and barstate.isconfirmed)
- strategy.entry("short", strategy.short)
- ////FAST/SLOW lenghts///
- STClenght= input.int(14, title = "STClenght", minval=1)
- STCFastLenght=input.int(14, title = "STC Fast Lenght", minval=1)
- STCSlowLenght= input.int(3, title = "STC Slow lenght", minval=1)
- ////imputs STC//////
- periodK = input.int(14, title="%K Length", minval=1, tooltip = "lenght %K")
- smoothK = input.int(1, title="%K Smoothing", minval=1,tooltip = "Smoothing %K")
- periodD = input.int(3, title="%D Smoothing", minval=1, tooltip = "Smoothing %D")
- k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)
- d = ta.sma(k, periodD)
- //Plot STC//
- plot(k, title="%K", color=#32f50c)
- plot(d, title="%D", color=#ff2600)
- 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")
Advertisement
Comments
-
- download all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment