gogo2/Niki/new.pine
2024-01-12 16:09:56 +02:00

72 lines
2.5 KiB
Plaintext

//@version=4
indicator("DrNiki's Market Nuker", shorttitle="DrNiki's Market Nuker", overlay=true)
// Input for Indicators
rsiLength = input(14, title="RSI Length")
stochRsiLength = input(14, title="Stochastic RSI Length")
n1 = input(10, title="WT Channel Length")
n2 = input(21, title="WT Average Length")
// Wavetrend Indicator Calculation
ap = hlc3
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1, 4)
// RSI and Stochastic RSI Calculation
rsiValue = rsi(close, rsiLength)
stochRsiValue = stoch(rsiValue, rsiValue, rsiValue, stochRsiLength)
// Function to calculate points for a given indicator and pair
calcPoints(currentValue, previousValue, isInverse) =>
value = 0
if isInverse
value := currentValue < previousValue ? 1 : currentValue > previousValue ? -1 : 0
else
value := currentValue > previousValue ? 1 : currentValue < previousValue ? -1 : 0
value
// Calculate points for each currency pair
longPoints(pair, isInverse) =>
rsiP = calcPoints(rsiValue, rsiValue[1], isInverse)
stochRsiP = calcPoints(stochRsiValue, stochRsiValue[1], isInverse)
wavetrendP = calcPoints(wt1, wt1[1], isInverse)
rsiP + stochRsiP + wavetrendP
shortPoints(pair, isInverse) => -longPoints(pair, isInverse)
// Hardcoded pairs and their corresponding inverse flags
pairs = array.new_string(5)
array.set(pairs, 0, "US30")
array.set(pairs, 1, "GOLD")
array.set(pairs, 2, "DXY")
array.set(pairs, 3, "BTCUSDT.P")
array.set(pairs, 4, syminfo.tickerid)
isInverse = array.new_bool(5, false)
array.set(isInverse, 2, true) // Inverse for DXY
// Initialize variables for storing points
var float totalLongPoints = 0
var float totalShortPoints = 0
// Calculate points for each pair
for i = 0 to 4
pair = array.get(pairs, i)
inverseFlag = array.get(isInverse, i)
totalLongPoints := totalLongPoints + longPoints(pair, inverseFlag)
totalShortPoints := totalShortPoints + shortPoints(pair, inverseFlag)
// Display the results
plot(totalLongPoints, title="Total Long Points", color=color.blue)
plot(totalShortPoints, title="Total Short Points", color=color.orange)
// BUYING VOLUME AND SELLING VOLUME
buyVolume = high == low ? 0 : volume * (close - low) / (high - low)
sellVolume = high == low ? 0 : volume * (high - close) / (high - low)
plot(volume, style=plot.style_columns, color=color.red, title="SELL V") // shows total volume
plot(buyVolume, style=plot.style_columns, color=color.teal, title="BUY V") // shows only buy volume