Dear All,
today i would like to presend an interesting indicator, which I use frequently for Furures (5min.,1min.) gaining good result.
AS alqways, my coding skills are basic..I could not solve last 3x lines for PLOt / DRAWLINE..
{{
DEFPARAM CalculateonLastBars = 500
Length = 200 // Standardlänge
// Gaussian Kernel Berechnung ohne Funktion
currentWeight = 0
cumulativeWeight = 0
FOR i = 0 TO Length – 1 DO
weight = EXP(- (i * i) / (2 * ((Length / 3) * (Length / 3))))
currentWeight = currentWeight + close[i] * weight
cumulativeWeight = cumulativeWeight + weight
NEXT
Ghat = currentWeight / cumulativeWeight
// Rolling Standard Deviation Berechnung ohne Funktion
sumVal = 0
sumSq = 0
FOR i = 0 TO Length – 1 DO
sumVal = sumVal + close[i]
sumSq = sumSq + (close[i] * close[i])
NEXT
mean = sumVal / Length
variance = (sumSq / Length) – (mean * mean)
Deviation = SQRT(MAX(variance, 0))
// Berechnungen
Upper = Ghat + Deviation
Lower = Ghat – Deviation
// Plots (Linien)
DRAWHLINE(Upper, RGB(0, 120, 255)) // Zeichnet die Linie für Upper
DRAWHLINE(Lower, RGB(0, 120, 255)) // Zeichnet die Linie für Lower
DRAWHLINE(Ghat, RGB(0, 255, 0)) // Zeichnet die Linie für Ghat
RETURN}}
Please, could you support me in solving graphical problems?
Below, please find a screenshot on trading ideas with this indicator.
(5min. channel= blue, yellow / 1min. channel=pink, green) / 1h channel= orange dotted line)
Thank you very much.
Regards to all!
JSParticipant
Master
Here is the adjusted indicator:
DEFPARAM CalculateonLastBars = 500
Length = 200 // Standardlänge
// Gaussian Kernel Berechnung ohne Funktion
CurrentWeight = 0
CumulativeWeight = 0
FOR i = 0 TO Length - 1 DO
Weight = EXP(- (i * i) / (2 * ((Length / 3) * (Length / 3))))
currentWeight = currentWeight + close[i] * weight
cumulativeWeight = cumulativeWeight + weight
NEXT
Ghat = currentWeight / cumulativeWeight
// Rolling Standard Deviation Berechnung ohne Funktion
sumVal = 0
sumSq = 0
FOR i = 0 TO Length - 1 DO
sumVal = sumVal + close[i]
sumSq = sumSq + (close[i] * close[i])
NEXT
mean = sumVal / Length
variance = (sumSq / Length) - (mean * mean)
Deviation = SQRT(MAX(variance, 0))
// Berechnungen
Upper = Ghat + Deviation
Lower = Ghat - Deviation
RETURN Ghat as "Ghat" Coloured(0,255,0), Upper as "Upper" Coloured(0,120,255),Lower as "Lower" Coloured(0,120,255)
@JS
Hello JS,
thank you very much – merci beaucoup – bedankt.
Great job and support from you…works perfect!
One questions: is it possible to display (and code) 5min- channel displayed in 1min- period???
All the best.
Thanx
Micha
JSParticipant
Master
When you use this indicator, based on a 5-minute timeframe, you can display it in a graph with a 1-minute timeframe…
DEFPARAM CalculateonLastBars = 500
TimeFrame(5 minutes,UpdateOnClose)
Length = 200 // Standard Period
// Gaussian Kernel Calculation
CurrentWeight = 0
CumulativeWeight = 0
FOR i = 0 TO Length - 1 DO
Weight = EXP(- (i * i) / (2 * ((Length / 3) * (Length / 3))))
currentWeight = currentWeight + close[i] * weight
cumulativeWeight = cumulativeWeight + weight
NEXT
Ghat = currentWeight / cumulativeWeight
// Rolling Standard Deviation Calculation
sumVal = 0
sumSq = 0
FOR i = 0 TO Length - 1 DO
sumVal = sumVal + close[i]
sumSq = sumSq + (close[i] * close[i])
NEXT
mean = sumVal / Length
variance = (sumSq / Length) - (mean * mean)
Deviation = SQRT(MAX(variance, 0))
// Band Calculations
Upper = Ghat + Deviation
Lower = Ghat - Deviation
TimeFrame(Default)
//Plotting
RETURN Ghat as "Ghat" Coloured(0,255,0), Upper as "Upper" Coloured(0,120,255),Lower as "Lower" Coloured(0,120,255)
Hello JS,
wow..you are the best..great!
You saved me a lot of coding (“try and error”).. 🙂
Thank you once again for your fast support and coding.
Bedankt!
Thanx,
Micha
JSParticipant
Master
Thanks, Micha! Hope it works out for you…