niki first
This commit is contained in:
parent
d88128c7f9
commit
5b700c45ad
117
Niki/tradingview.pinescript
Normal file
117
Niki/tradingview.pinescript
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
//@version=5
|
||||||
|
indicator("drniki nuke", shorttitle="DN", overlay=true)
|
||||||
|
|
||||||
|
// Relative Strength Index (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)
|
||||||
|
|
||||||
|
// Initialize points for BTCUSDT.P
|
||||||
|
longPointsRSIBTC = close > close[1] ? 1 : 0
|
||||||
|
shortPointsRSIBTC = close < close[1] ? 1 : 0
|
||||||
|
longPointsStochRSIBTC = stochRsiValue > stochRsiValue[1] ? 1 : 0
|
||||||
|
shortPointsStochRSIBTC = stochRsiValue < stochRsiValue[1] ? 1 : 0
|
||||||
|
longPointsWavetrendBTC = wt1 > wt1[1] ? 1 : 0
|
||||||
|
shortPointsWavetrendBTC = wt1 < wt1[1] ? 1 : 0
|
||||||
|
|
||||||
|
// Initialize points for DXY
|
||||||
|
longPointsRSIDXY = close > close[1] ? 1 : 0
|
||||||
|
shortPointsRSIDXY = close < close[1] ? 1 : 0
|
||||||
|
longPointsStochRSIDXY = stochRsiValue > stochRsiValue[1] ? 1 : 0
|
||||||
|
shortPointsStochRSIDXY = stochRsiValue < stochRsiValue[1] ? 1 : 0
|
||||||
|
longPointsWavetrendDXY = wt1 < wt1[1] ? 1 : 0 // Inversed for DXY
|
||||||
|
shortPointsWavetrendDXY = wt1 > wt1[1] ? 1 : 0 // Inversed for DXY
|
||||||
|
|
||||||
|
// Initialize points for GOLD
|
||||||
|
longPointsRSIGOLD = close > close[1] ? 1 : 0
|
||||||
|
shortPointsRSIGOLD = close < close[1] ? 1 : 0
|
||||||
|
longPointsStochRSIGOLD = stochRsiValue > stochRsiValue[1] ? 1 : 0
|
||||||
|
shortPointsStochRSIGOLD = stochRsiValue < stochRsiValue[1] ? 1 : 0
|
||||||
|
longPointsWavetrendGOLD = wt1 > wt1[1] ? 1 : 0
|
||||||
|
shortPointsWavetrendGOLD = wt1 < wt1[1] ? 1 : 0
|
||||||
|
|
||||||
|
// Initialize points for US30
|
||||||
|
longPointsRSIUS30 = close > close[1] ? 1 : 0
|
||||||
|
shortPointsRSIUS30 = close < close[1] ? 1 : 0
|
||||||
|
longPointsStochRSIUS30 = stochRsiValue > stochRsiValue[1] ? 1 : 0
|
||||||
|
shortPointsStochRSIUS30 = stochRsiValue < stochRsiValue[1] ? 1 : 0
|
||||||
|
longPointsWavetrendUS30 = wt1 > wt1[1] ? 1 : 0
|
||||||
|
shortPointsWavetrendUS30 = wt1 < wt1[1] ? 1 : 0
|
||||||
|
|
||||||
|
// Initialize points for the current trading pair (PAIR)
|
||||||
|
longPointsRSIPAIR = close > close[1] ? 1 : 0
|
||||||
|
shortPointsRSIPAIR = close < close[1] ? 1 : 0
|
||||||
|
longPointsStochRSIPAIR = stochRsiValue > stochRsiValue[1] ? 1 : 0
|
||||||
|
shortPointsStochRSIPAIR = stochRsiValue < stochRsiValue[1] ? 1 : 0
|
||||||
|
longPointsWavetrendPAIR = wt1 > wt1[1] ? 1 : 0
|
||||||
|
shortPointsWavetrendPAIR = wt1 < wt1[1] ? 1 : 0
|
||||||
|
|
||||||
|
// Adjust the total points calculation for DXY
|
||||||
|
totalLongPointsDXY = longPointsRSIDXY + longPointsStochRSIDXY + shortPointsWavetrendDXY
|
||||||
|
totalShortPointsDXY = shortPointsRSIDXY + shortPointsStochRSIDXY + longPointsWavetrendDXY
|
||||||
|
|
||||||
|
// Calculate total points for each symbol
|
||||||
|
totalLongPointsBTC = longPointsRSIBTC + longPointsStochRSIBTC + longPointsWavetrendBTC
|
||||||
|
totalShortPointsBTC = shortPointsRSIBTC + shortPointsStochRSIBTC + shortPointsWavetrendBTC
|
||||||
|
|
||||||
|
totalLongPointsGOLD = longPointsRSIGOLD + longPointsStochRSIGOLD + longPointsWavetrendGOLD
|
||||||
|
totalShortPointsGOLD = shortPointsRSIGOLD + shortPointsStochRSIGOLD + shortPointsWavetrendGOLD
|
||||||
|
|
||||||
|
totalLongPointsUS30 = longPointsRSIUS30 + longPointsStochRSIUS30 + longPointsWavetrendUS30
|
||||||
|
totalShortPointsUS30 = shortPointsRSIUS30 + shortPointsStochRSIUS30 + shortPointsWavetrendUS30
|
||||||
|
|
||||||
|
totalLongPointsPAIR = longPointsRSIPAIR + longPointsStochRSIPAIR + longPointsWavetrendPAIR
|
||||||
|
totalShortPointsPAIR = shortPointsRSIPAIR + shortPointsStochRSIPAIR + shortPointsWavetrendPAIR
|
||||||
|
|
||||||
|
// Calculate total long and short probabilities for all symbols
|
||||||
|
totalLongPoints = totalLongPointsBTC + totalLongPointsDXY + totalLongPointsGOLD + totalLongPointsUS30 + totalLongPointsPAIR
|
||||||
|
totalShortPoints = totalShortPointsBTC + totalShortPointsDXY + totalShortPointsGOLD + totalShortPointsUS30 + totalShortPointsPAIR
|
||||||
|
|
||||||
|
// Calculate combined probabilities for each symbol
|
||||||
|
combinedProbabilityLongBTC = totalLongPointsBTC / 3 * 100
|
||||||
|
combinedProbabilityShortBTC = totalShortPointsBTC / 3 * 100
|
||||||
|
|
||||||
|
combinedProbabilityLongDXY = totalLongPointsDXY / 3 * 100
|
||||||
|
combinedProbabilityShortDXY = totalShortPointsDXY / 3 * 100
|
||||||
|
|
||||||
|
combinedProbabilityLongGOLD = totalLongPointsGOLD / 3 * 100
|
||||||
|
combinedProbabilityShortGOLD = totalShortPointsGOLD / 3 * 100
|
||||||
|
|
||||||
|
combinedProbabilityLongUS30 = totalLongPointsUS30 / 3 * 100
|
||||||
|
combinedProbabilityShortUS30 = totalShortPointsUS30 / 3 * 100
|
||||||
|
|
||||||
|
combinedProbabilityLongPAIR = totalLongPointsPAIR / 3 * 100
|
||||||
|
combinedProbabilityShortPAIR = totalShortPointsPAIR / 3 * 100
|
||||||
|
|
||||||
|
// Calculate combined probabilities for all symbols
|
||||||
|
combinedProbabilityLong = totalLongPoints / 15 * 100
|
||||||
|
combinedProbabilityShort = totalShortPoints / 15 * 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: BTC " + str.tostring(combinedProbabilityLongBTC) + "%, DXY " + str.tostring(combinedProbabilityLongDXY) + "%, GOLD " + str.tostring(combinedProbabilityLongGOLD) + "%, US30 " + str.tostring(combinedProbabilityLongUS30) + "%, PAIR " + str.tostring(combinedProbabilityLongPAIR) + "%\nShort: BTC " + str.tostring(combinedProbabilityShortBTC) + "%, DXY " + str.tostring(combinedProbabilityShortDXY) + "%, GOLD " + str.tostring(combinedProbabilityShortGOLD) + "%, US30 " + str.tostring(combinedProbabilityShortUS30) + "%, PAIR " + str.tostring(combinedProbabilityShortPAIR) + "%\n\nTotal: Long " + str.tostring(combinedProbabilityLong) + "%, Short " + str.tostring(combinedProbabilityShort) + "%")
|
||||||
|
|
||||||
|
label.set_color(labelBox, color.new(color.blue, 0))
|
||||||
|
label.set_style(labelBox, label.style_label_left)
|
Loading…
x
Reference in New Issue
Block a user