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/
- // © NKactive
- //@version=5
- strategy("NK RSI++ ", overlay=false, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=0, slippage=1)
- // Credit for original indicator to LazyBear
- 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)
- //
- // ****************************************************************************************************************************************************************
- //
- lengthRSI = input(25)
- lengthROC = input(25)
- src = close
- overbought = input(0)
- oversold = input(0)
- fastMACDLength = input(10)
- slowMACDLength = input(21)
- lengthCCI = input(50)
- lengthStoch = input(14)
- smoothK = input(3)
- macd(source, fastLength, slowLength) =>
- fastMA = ta.ema(source, fastLength)
- slowMA = ta.ema(source, slowLength)
- fastMA - slowMA
- acc = (ta.rsi(src, lengthRSI) + ta.roc(src, lengthROC) + macd(src, fastMACDLength, slowMACDLength) + ta.cci(src, lengthCCI) + ta.sma(ta.stoch(close, high, low, lengthStoch), smoothK)) / 5.0
- acc_ob = acc > overbought
- acc_os = acc < oversold
- plot(acc, color=acc_ob ? color.red : acc_os ? color.green : color.white, linewidth=1)
- // ****************************************************************************************************************************************************************
- // ****************************************************************************************************************************************************************
- // Call combine signals and execute buy/sell positions within timeframe
- //.****************************************************************************************************************************************************************
- // Date Range To Include
- startDate = timestamp("2018-01-01T00:00")
- endDate = time
- // Check if the current timestamp is within the restricted range
- inRestrictedRange = time >= startDate and time <= endDate
- //
- // Buy Signals on overbought and oversold
- //
- if inRestrictedRange and acc_os// ADD OTHER BUY SIGNAL BOOLS
- strategy.entry("My Long Entry Id", strategy.long, 100)
- if inRestrictedRange and acc_ob // ADD OTHER BUY SIGNAL BOOLS
- strategy.entry("My Short Entry Id", strategy.short, 100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement