glaz

Slow Heiken Ashi

12872 views
2729
Period= Length of the slow HA
Fastend and Slowend = just calculations for the Kama function no need to change those.
Signal= Shows/Hides the triangles
Remove from Favorite Scripts Add to Favorite Scripts
study("Slow Heiken Ashi",overlay=true,precision=0)
//by Glaz.
//KAMA function
p=input(6,title='Period')
fastend=input(0.666,step=0.001)
slowend=input(0.0645,step=0.0001)
kama(close,amaLength)=>
    diff=abs(close[0]-close[1])
    signal=abs(close-close[amaLength])
    noise=sum(diff, amaLength)
    efratio=noise!=0 ? signal/noise : 1
    smooth=pow(efratio*(fastend-slowend)+slowend,2)
    kama=nz(kama[1], close)+smooth*(close-nz(kama[1], close))
    kama

//Slow Heiken Ashi
hakamaper=1/2
Signal=input(true)
Om=sma(open,p)
Hm=sma(high,p)
Lm=sma(low,p)
Cm=sma(close,p)
vClose=(Om+Hm+Lm+Cm)/4
vOpen= kama(vClose[1],hakamaper)
vHigh= max(Hm,max(vClose, vOpen))
vLow=  min(Lm,min(vClose, vOpen))

// Plots
vcolor= vOpen>vClose ?red:green
plotcandle(vOpen,vHigh,vLow,vClose,color=vcolor)

//signals
plotchar(Signal?(cross(vOpen,vClose) and vOpen[1]<vClose[1]?vHigh:na):na,char='▼',color=white,transp=0,location=location.absolute)
plotchar(Signal?(cross(vOpen,vClose) and vOpen[1]>vClose[1]?vLow:na):na,char='▲',color=white,transp=0,location=location.absolute)

//http://www.wisestocktrader.com/indicators/3110-heikein-ashi-smooth-trading-system

Comments

I'm getting this when trying to apply...

Invalid value of the `length’ argument (0) `sum’ in the function. It should be >0

How do i remedy?
+26 Reply
Mohi1006 Nomallfx
@Nomallfx, change the 17 line
hakamaper=1
+6 Reply
StillAlive Mohi1006
@Mohi1006, thnx :)
Reply
ryanhhh Mohi1006
@Mohi1006,
Hello.
I have tried doing this but it's still saying `length’ argument (0) `sum’ in the function. It should be >0'
Do you have to activate this change once you have altered the code?
Many thanks

P.S. I just discovered you have to reapply the indicator to the chart then it works fine
Reply
Abady-Habra Nomallfx
@Nomallfx, did you find the solution?
Reply
Hi Glaz.
Love this script. Nice job.
Just a litter contribution . Add this couples of lines in order to have the signal Alert.

short= cross(vOpen,vClose) and vOpen<vClose?vHigh:na
long= cross(vOpen,vClose) and vOpen>vClose?vLow:na
alertcondition(short,title='Short Signal', message='Short Signal')
alertcondition(long,title='Long Signal', message='Long Signal')
+14 Reply
swordfighter ruben.castro.359
thanks for writing the alerts great help
Reply
willowcharts ruben.castro.359
@ruben.castro.359, Please forgive my lack of coding ability but where in the script do I paste this. I love this indicator and would love if it signaled which I think thats what this is allowing. Appreciate the help in advance.
Reply
glaz willowcharts
@willowcharts, at the end of the script, but prolly i need to update the script since its been asked alot of times
Reply
@glaz, I am sure it would be appreciated. This is my favorite indicator for trend trading. Thanks for the speedy reply. I will attempt to add it now and let you know how it works...damn I wish I understood this coding stuff LOL
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out