PHP Code:
//@version=5
indicator(title='Moonhub Cycle Index', shorttitle='Moonhub Cycle', overlay=true)
// Input parameters
len_DIema = input.int(5, minval=1, title='COEMA Length')
len_DIsma = input.int(20, minval=1, title='COSMA Length')
// Indicators
src = close
len = 14
// Moving Average Convergence Divergence (MACD)
//[macdLine, signalLine, _] = ta.macd(src, 12, 26, 9)
start1 = input(0)
increment1 = input(0.1)
maximum1 = input(1, "Max Value")
out1 = ta.sar(start1, increment1, maximum1)
//plot(out1, "ParabolicSAR", style=plot.style_cross, color=#2962FF)
// Schaff Trend Cycle (STC)
//stc = ta.stoch(close, high, low, 10)
start2 = input(0)
increment2 = input(0.01)
maximum2 = input(0.1, "Max Value")
out2 = ta.sar(start2, increment2, maximum2)
//plot(out2, "ParabolicSAR", style=plot.style_cross, color=#2962FF)
// Detrended Price Oscillator (DPO) custom function
//dpo(src, len) =>
//shift = len / 2 + 1
// price = src[shift]
// dpo = price - ta.sma(src, len)
//dpo
//custom_dpo = dpo(src, len)
start3 = input(0.1)
increment3 = input(0.1)
maximum3 = input(0.1, "Max Value")
out3 = ta.sar(start3, increment3, maximum3)
//plot(out3, "ParabolicSAR", style=plot.style_cross, color=#2962FF)
// Create a custom index
index = (out1 + out2 + out3) / 3
// Calculate COEMA and COSMA for the Custom Index
DI_index_Co_E = ta.ema(index, len_DIema)
DI_Co_indexS = ta.sma(index, len_DIsma)
// Plot the index
plot(index, title='Custom Index', color=color.new(color.red, 0), linewidth=2)
plot(DI_index_Co_E, title='COEMA', color=color.new(color.blue, 0), linewidth=2)
plot(DI_Co_indexS, title='COSMA', color=color.new(color.green, 0), linewidth=2)
Yer İmleri