fix pines

This commit is contained in:
Dobromir Popov
2024-01-12 16:56:05 +02:00
parent bae87ad380
commit 5ef4bad84c
2 changed files with 72 additions and 33 deletions

View File

@ -1,7 +1,7 @@
//@version=4
study("DrNiki's Market Nuker", shorttitle="DrNiki's Market Nuker", overlay=true)
//@version=5
indicator("DrNiki's Market Nuker", shorttitle="DrNiki's Market Nuker", overlay=true)
// Input for Indicators
// [Input for Indicators]
rsiLength = input(14, title="RSI Length")
stochRsiLength = input(14, title="Stochastic RSI Length")
n1 = input(10, title="WT Channel Length")
@ -9,16 +9,29 @@ n2 = input(21, title="WT Average Length")
// Wavetrend Indicator Calculation
ap = hlc3
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
esa = ta.ema(ap, n1)
d = ta.ema(math.abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)
tci = ta.ema(ci, n2)
wt1 = tci
wt2 = sma(wt1, 4)
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)
// RSI and Stochastic RSI Calculation
rsiValue = rsi(close, rsiLength)
stochRsiValue = stoch(rsiValue, rsiValue, rsiValue, stochRsiLength)
rsiValue = ta.rsi(close, rsiLength)
stochRsiValue = ta.stoch(rsiValue, rsiValue, rsiValue, stochRsiLength)
// [Function to calculate points for a given indicator and pair]
// Function to calculate points for a given indicator and pair
calcPoints(currentValue, previousValue, isInverse) =>
@ -38,6 +51,7 @@ longPoints(pair, isInverse) =>
shortPoints(pair, isInverse) => -longPoints(pair, isInverse)
// Hardcoded pairs and their corresponding inverse flags
pairs = array.new_string(5)
array.set(pairs, 0, "US30")
@ -54,18 +68,22 @@ var float totalLongPoints = 0
var float totalShortPoints = 0
// Calculate points for each pair
longPointsArray = array.new_float(5)
shortPointsArray = array.new_float(5)
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)
array.set(longPointsArray, i, longPoints(pair, inverseFlag))
array.set(shortPointsArray, i, shortPoints(pair, inverseFlag))
// Update total points
for i = 0 to 4
totalLongPoints := totalLongPoints + array.get(longPointsArray, i)
totalShortPoints := totalShortPoints + array.get(shortPointsArray, i)
// 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
// Display