niki new
This commit is contained in:
parent
ed545a1ddb
commit
2093561046
80
Niki/niki2.pine
Normal file
80
Niki/niki2.pine
Normal file
@ -0,0 +1,80 @@
|
||||
//@version=5
|
||||
indicator("DrNiki's Market Nuker", shorttitle="DrNiki's Market Nuker", overlay=true)
|
||||
|
||||
// Function to calculate RSI
|
||||
rsiLength = input(14, title="RSI Length")
|
||||
rsiValue = ta.rsi(close, rsiLength)
|
||||
|
||||
// Stochastic RSI
|
||||
stochRsiLength = input(14, title="Stochastic RSI Length")
|
||||
stochRsiValue = ta.stoch(close, close, close, stochRsiLength)
|
||||
|
||||
// Wavetrend Indicator
|
||||
n1 = input(10, "Channel Length")
|
||||
n2 = input(21, "Average Length")
|
||||
obLevel1 = input(60, "Over Bought Level 1")
|
||||
obLevel2 = input(53, "Over Bought Level 2")
|
||||
osLevel1 = input(-60, "Over Sold Level 1")
|
||||
osLevel2 = input(-53, "Over Sold Level 2")
|
||||
|
||||
ap = hlc3
|
||||
esa = ta.ema(ap, n1)
|
||||
d = ta.ema(math.abs(ap - esa), n1)
|
||||
ci = (ap - esa) / (0.015 * d)
|
||||
tci = ta.ema(ci, n2)
|
||||
|
||||
wt1 = tci
|
||||
wt2 = ta.sma(wt1, 4)
|
||||
|
||||
// Custom implementation of On Balance Volume (OBV)
|
||||
var float obv = na
|
||||
obv := close > close[1] ? obv + volume : close < close[1] ? obv - volume : obv
|
||||
|
||||
// Money Flow Index (MFI)
|
||||
mfiLength = input(7, title="MFI Length")
|
||||
mfiValue = ta.mfi(close, mfiLength)
|
||||
|
||||
// Initialize points for each timeframe
|
||||
longPointsRSI = close > close[1] ? 1 : 0
|
||||
shortPointsRSI = close < close[1] ? 1 : 0
|
||||
longPointsStochRSI = stochRsiValue > stochRsiValue[1] ? 1 : 0
|
||||
shortPointsStochRSI = stochRsiValue < stochRsiValue[1] ? 1 : 0
|
||||
longPointsWavetrend = wt1 > wt1[1] ? 1 : 0
|
||||
shortPointsWavetrend = wt1 < wt1[1] ? 1 : 0
|
||||
longPointsOBV = obv > obv[1] ? 1 : 0
|
||||
shortPointsOBV = obv < obv[1] ? 1 : 0
|
||||
longPointsMFI = mfiValue > 50 ? 1 : 0
|
||||
shortPointsMFI = mfiValue < 50 ? 1 : 0
|
||||
|
||||
// Calculate total points for each timeframe
|
||||
totalLongPoints = longPointsRSI + longPointsStochRSI + longPointsWavetrend + longPointsOBV + longPointsMFI
|
||||
totalShortPoints = shortPointsRSI + shortPointsStochRSI + shortPointsWavetrend + shortPointsOBV + shortPointsMFI
|
||||
|
||||
// Calculate combined probabilities for each timeframe
|
||||
combinedProbabilityLong = totalLongPoints / 5 * 100
|
||||
combinedProbabilityShort = totalShortPoints / 5 * 100
|
||||
|
||||
// Display combined probabilities in a box at the top right corner
|
||||
var labelBox = label.new(na, na, "")
|
||||
label.set_xy(labelBox, bar_index, high)
|
||||
label.set_text(labelBox, "Long: " + str.tostring(combinedProbabilityLong) + "%\nShort: " + str.tostring(combinedProbabilityShort) + "%")
|
||||
label.set_color(labelBox, color.new(color.blue, 0))
|
||||
label.set_style(labelBox, label.style_label_left)
|
||||
|
||||
// Display on different timeframes
|
||||
rsiValue1H = ta.rsi(close, 14)
|
||||
rsiValue2H = ta.rsi(close, 28)
|
||||
rsiValue3H = ta.rsi(close, 42)
|
||||
rsiValue4H = ta.rsi(close, 56)
|
||||
|
||||
// Odds calculation for each timeframe
|
||||
odds1H = (longPointsRSI + longPointsStochRSI + longPointsWavetrend + longPointsOBV + longPointsMFI) / 5 * 100
|
||||
odds2H = (shortPointsRSI + shortPointsStochRSI + shortPointsWavetrend + shortPointsOBV + shortPointsMFI) / 5 * 100
|
||||
odds3H = (longPointsRSI + longPointsStochRSI + longPointsWavetrend + longPointsOBV + longPointsMFI) / 5 * 100
|
||||
odds4H = (shortPointsRSI + shortPointsStochRSI + shortPointsWavetrend + shortPointsOBV + shortPointsMFI) / 5 * 100
|
||||
|
||||
// Plotting
|
||||
plot(rsiValue1H, title="RSI 1H", color=color.new(color.red, 0), linewidth=2)
|
||||
plot(rsiValue2H, title="RSI 2H", color=color.new(color.blue, 0), linewidth=2)
|
||||
plot(rsiValue3H, title="RSI 3H", color=color.new(color.green, 0), linewidth=2)
|
||||
plot(rsiValue4H, title="RSI 4H", color=color.new(color.purple, 0), linewidth=2)
|
Loading…
x
Reference in New Issue
Block a user