Files
gogo2/Niki/new.pine
Dobromir Popov fca4c10820 new to v4
2024-01-12 15:55:00 +02:00

65 lines
2.3 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)
// Hardcode the pairs and their corresponding inverse flags
pairs = ["US30", "GOLD", "DXY", "BTCUSDT.P", syminfo.tickerid]
isInverse = [false, false, true, false, false] // 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 = pairs[i]
inverseFlag = 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