Introducing my trading script for open source contributions and ideas: Monkeyblackmail

4Yuz...Rhhb
1 Jan 2024
94

This script v1 consists of several sections. test it and tell me your concerns. a lot of more works will be done

Volume Accumulation: The first part of the script checks for a new 5-minute interval and accumulates the volume of the current interval. It separates the volume into buying volume and selling volume based on whether the closing price is closer to the high or low of the bar.
Volume Normalization and Pressure Calculation: The script then normalizes the volume with a 20-period EMA, and calculates buying pressure, selling pressure, and total pressure. These calculations provide insight into the underlying demand (buying pressure) and supply (selling pressure) conditions in the market.
RSI Calculation and Overbought/Oversold Conditions: The script calculates the RSI (Relative Strength Index) and checks whether it is in an overbought (RSI > 70) or oversold (RSI < 30) state. The RSI is a momentum indicator, providing insights into the speed and change of price movements.
Volume Condition Check and Wondertrend Indicator: The script checks if the volume is high for the past five bars. If it is, it applies the Wondertrend Indicator, which uses a combination of the Parabolic SAR (Stop and Reverse) and Keltner Channel to identify potential trends in the market.
Swing High/Low and Fibonacci Retracement: The script identifies swing high and swing low points using a specified pivot length. Then, it draws Fibonacci retracement levels between these swing high and swing low points.

The monkeyblackmail script works well in the 5 minutes chart and combines several elements of technical analysis, including volume analysis, momentum indicators, trend-following indicators, volatility channels, and Fibonacci retracements. It aims to provide a comprehensive view of the market condition, highlighting key levels and potential trends in an easily understandable format. Don’t be too quick to start trading with it, first study how it work and you will blackmail the market.

This optimized v1.1 script consists of several sections. test it and tell me your concerns. a lot of more works will be done

Volume Accumulation: The first part of the script checks for a new 5-minute interval and accumulates the volume of the current interval. It separates the volume into buying volume and selling volume based on whether the closing price is closer to the high or low of the bar.
Volume Normalization and Pressure Calculation: The script then normalizes the volume with a 20-period EMA, and calculates buying pressure, selling pressure, and total pressure. These calculations provide insight into the underlying demand (buying pressure) and supply (selling pressure) conditions in the market.
RSI Calculation and Overbought/Oversold Conditions: The script calculates the RSI (Relative Strength Index) and checks whether it is in an overbought (RSI > 70) or oversold (RSI < 30) state. The RSI is a momentum indicator, providing insights into the speed and change of price movements.
Volume Condition Check and Wondertrend Indicator: The script checks if the volume is high for the past five bars. If it is, it applies the Wondertrend Indicator, which uses a combination of the Parabolic SAR (Stop and Reverse) and Keltner Channel to identify potential trends in the market.
Swing High/Low and Fibonacci Retracement: The script identifies swing high and swing low points using a specified pivot length. Then, it draws Fibonacci retracement levels between these swing high and swing low points.

The monkeyblackmail script works well in the 5 minutes chart and combines several elements of technical analysis, including volume analysis, momentum indicators, trend-following indicators, volatility channels, and Fibonacci retracements. It aims to provide a comprehensive view of the market condition, highlighting key levels and potential trends in an easily understandable format. Don’t be too quick to start trading with it, first study how it work and you will blackmail the market.

Script: 

//@version=4
// Script created by Monkeyblackmail
// Monkeyblackmail with swing highs, swing lows, and Fibonacci retracements effect + volume and RSI movements
study("Optimized Monkeyblackmail with swing highs, swing lows + volume and RSI movements", format=format.volume, precision=0, overlay=false)

// Define the 5-minute timeframe
timeframe = "5"

// Calculate if the current bar represents the start of a new 5-minute interval
isNewInterval = change(time(timeframe)) != 0

// Accumulate the volume within the 5-minute interval
var float accumulatedVolume = na
accumulatedVolume := isNewInterval ? volume : nz(accumulatedVolume[1]) + volume

// BUYING VOLUME AND SELLING VOLUME //
BV = iff((high == low), 0, accumulatedVolume * (close - low) / (high - low))
SV = iff((high == low), 0, accumulatedVolume * (high - close) / (high - low))

vol = iff(accumulatedVolume > 0, accumulatedVolume, 1)

// Karthik Marar's Pressure Volume Normalized Version (XeL-MOD.)
VN = vol / ema(vol, 20)
BPN = BV / ema(BV, 20) * VN * 100
SPN = SV / ema(SV, 20) * VN * 100
TPN = BPN + SPN

// Normalize the BPV, SPV, and TPV variables
BPV = BV / (BV + SV)
SPV = SV / (BV + SV)
TPV = 1

// WonderTrend indicator settings
length = input(20, "Length")
upper = highest(length)
lower = lowest(length) 
[kc,kcu,kcl] = kc(close, length,1,true)  
start = input(0.02, "PSAR Start")  
increment = input(0.02, "PSAR Step")
maximum = input(0.2, "PSAR Max")

// RSI indicator settings
src = close
len = input(14, minval=1, title="Length")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

// Check for RSI crossings
isup() => rsi > 70
isdown() => rsi < 30

// Check for volume condition
highVol = sum(VN > 10 ? 1 : 0, 5) == 5

// WonderTrend indicator calculations
var psar = close
psar := sar(start, increment, maximum) < close ? 1 : -1  // psar trend
var wavelen = 0
var save = sar(start, increment, maximum)
if psar != psar[1]
    save := sar(start, increment, maximum)[1]
wavelen := psar == 1 and low > max(kc,low[2]) and low[1] > save and low[2] > max(kc,save) or psar == -1 and high < min(kc,high[2]) and high[1] < save and high[2] < min(kc,save)?  3 : 0
var trend = 1
trend := nz(trend[1], trend)
trend := trend <= 0 and wavelen >= 3 and psar == 1 ? 1 : trend >= 0 and wavelen >= 3 and psar == -1 ? -1 : trend  // psar + keltner trend
trend := trend == -1 and save > save[1] or trend == 1 and save < save[1] ? 0 : trend
var ptrend = 1
ptrend := trend != 0? trend : ptrend[1] 
wave_color = trend == -1 and (psar == -1 or kc<=kc[1]) or ptrend==-1 and kc=kc[1]) or ptrend==1 and kc>kc[1]? color.green : color.yellow

// Add condition to show the WonderTrend indicator only when volume condition is met
plot(highVol ? kc : na, color=wave_color, title='Basis', linewidth=2, style=plot.style_stepline)

// Plot the volume, buying volume, selling volume
plot(isNewInterval ? volume : na, title="Volume", color = open > close ? color.red : color.green, style=plot.style_columns, linewidth=1)
plot(isNewInterval ? BV : na, title="BuyVolume", color=color.green, style=plot.style_columns)
plot(isNewInterval ? SV : na, title="SellVolume", color=color.red, style=plot.style_columns)

// Add RSI plot
plot(rsi, "RSI", color=color.blue)
hline(70, "Upper Level", color=color.red)
hline(30, "Lower Level", color=color.green)

// Coloring the bars based on RSI values only when volume condition is met
barcolor((highVol and isup()) ? color.green : (highVol and isdown()) ? color.red : na)

// Swing High/Low and Fibonacci levels
pivotLength = input(14, title="Pivot Length") //Define the length of pivot 
pHi = highest(high, pivotLength) == high[pivotLength] ? high[pivotLength] : na
pLo = lowest(low, pivotLength) == low[pivotLength] ? low[pivotLength] : na
plot(pHi, title="Swing High", color=color.green, linewidth=2, style=plot.style_cross)
plot(pLo, title="Swing Low", color=color.red, linewidth=2, style=plot.style_cross)

// Fibonacci retracement levels
fib_0 = 0
fib_1 = 0.236
fib_2 = 0.382
fib_3 = 0.5
fib_4 = 0.618
fib_5 = 0.786
fib_6 = 1

// Plot Fibonacci retracement levels between Swing High and Swing Low
fibRetrace() =>
    line.new(x1=bar_index[pivotLength], y1=pHi, x2=bar_index, y2=pLo, color=color.red, width = 1)
    line.new(x1=bar_index[pivotLength], y1=pHi, x2=bar_index, y2=pHi - (pHi - pLo) * fib_0, color=color.red)
    line.new(x1=bar_index[pivotLength], y1=pHi, x2=bar_index, y2=pHi - (pHi - pLo) * fib_1, color=color.orange)
    line.new(x1=bar_index[pivotLength], y1=pHi, x2=bar_index, y2=pHi - (pHi - pLo) * fib_2, color=color.yellow)
    line.new(x1=bar_index[pivotLength], y1=pHi, x2=bar_index, y2=pHi - (pHi - pLo) * fib_3, color=color.green)
    line.new(x1=bar_index[pivotLength], y1=pHi, x2=bar_index, y2=pHi - (pHi - pLo) * fib_4, color=color.blue)
    line.new(x1=bar_index[pivotLength], y1=pHi, x2=bar_index, y2=pHi - (pHi - pLo) * fib_5, color=color.purple)
    line.new(x1 = bar_index[2], y1 = pHi, x2 = bar_index, y2 = pHi, color = color.fuchsia, width = 1)

if(not na(pHi) and not na(pLo))
    fibRetrace()

Write & Read to Earn with BULB

Learn More

Enjoy this blog? Subscribe to whirlhat

18 Comments

B
No comments yet.
Most relevant comments are displayed, so some may have been filtered out.