We obtained the Ichimoku parameters from Span A instead of price. This makes Ichimoku smoother and provides better signals.
a=9
b=26
c=52
f1=TenkanSen[a,b,c]
f2=KijunSen[a,b,c]
/////////////////////////
g1=(f1+f2)/2
g2=highest[a](g1)
g3=highest[b](g1)
g4=lowest[a](g1)
g5=lowest[b](g1)
g6=highest[c](g1)
g7=lowest[c](g1)
tenken=(g2+g4)/2
kiju=(g3+g5)/2
spana=(tenken+kiju)/2
spanb=(g6+g7)/2
return tenken ,kiju,spana,spanb