MetaStock -> Tools -> Indicator Builder -> New -> Copy & paste complete formula between "---8<---" lines. ================== Ichimoku Kinko Hyo ================== ---8<----------------------------------------- {Ichimoku Kinko Hyo - v2.0 "Equilibrium chart at a glance" Created by Goichi Hosoda and released in 1968 http://www.kumotrader.com/ichimoku_wiki Modern trading calendar parameter suggestions in [] brackets. Default parameters based on older Japanese business calendar which includes Saturdays. Note: Set "Chikou Span" and "Kumo cloud" to 25pds to match default (incorrect) MetaStock version. Coded by Jose Silva at http://www.metastocktools.com} {Inputs} {1.5 old Japanese business weeks} pds1:=Input("Tenkan Sen periods [8]",1,260,9); {1 old Japanese business month} pds2:=Input("Kijun Sen periods [21]",1,260,26); {1 old Japanese business month} pds3:=Input("Chikou Span back-shift (hindsight) periods [21]",0,260,26); {2 old Japanese business months} pds4:=Input("Senkou Span B periods [42]", 1,260,52); {1 old Japanese business month} pds5:=Input("Kumo cloud forward-shift periods [21]",0,260,26); message:=Input("* Modern Western business calendar [parameters]",0,0,0); {Tenkan Sen - "turning line" (Highest High + Lowest Low)/2 for past 9pds} Tenkan:=(HHV(H,pds1)+LLV(L,pds1))/2; {Kijun Sen - "standard line" (Highest High + Lowest Low)/2 for past 26pds} Kijun:=(HHV(H,pds2)+LLV(L,pds2))/2; {Chikou Span - "lagging line" Close backward-shifted 26pds on chart into future (hindsight!)} Chikou:=Ref(C,pds3); {Senkou Span A - "1st leading line" (Tenkan Sen + Kijun Sen)/2 26pds forward-shifted on chart into past} SenkouA:=Ref((Tenkan+Kijun)/2,-pds5); {Senkou Span B - "2nd leading line" (Highest High + Lowest Low)/2 for past 52 pds 26pds forward-shifted on chart into past} SenkouB:=Ref((HHV(H,pds4)+LLV(L,pds4))/2,-pds5); {Ichimoku Kumo - "cloud"} odd:=Cum(1)/2=Int(Cum(1)/2); CloudUp1:=If(SenkouA>SenkouB, If(odd,SenkouA,SenkouB),SenkouB); CloudUp2:=If(SenkouA>SenkouB, If(odd=0,SenkouA,SenkouB),SenkouB); CloudDw1:=If(SenkouA