I'm using the basic charts that ships with Amibroker 6.00.2 standard edition. When I use the ichimoku chart I can see everthing but the chinku span, the delayed line. There is the parameter "delayed line period " but changing it only displaces the cloud. Is it supposed to be that way. How can I see chinku span.
@rockbusiness: As a new forum member, you can (and should) do a bit more looking around before posting. Try the SEARCH function - the magnifying glass in the top right.
Also, as a registered user of AB, you should have access to the Knowledge Base and Library. There may be other versions of the Ichimoku chart that are better suited to your needs.
And BEST of ALL, take a look at the CODE in the AFL that you have and modify it for your needs.
When you hit something (specific) that you don’t understand, check out the Help file and user guide and if you still can’t figure it out, post your sample and questions here.
Remember to use Code Blocks when posting code.
Hope this helps…
Hi snoopy,
Thank you for your reply. Yes I followed all the basic rules before posting a question here. I searched this forum, searched google, checked the AFL code but sadly I just started using Amibroker so haven’t still learned how to code. When I made sure there is no answer for this anywhere I asked this question here.
I got few other ichimoku AFL code that works but in other website so I couldn’t make sure they work correctly or not. Moreover my question wasn’t focused on how to make it. It is more like why doen’t the ichimoku chart works right off the bat as it should. All the other graphs I use works like charm but ichimoku has a missing element which is a basic element of the chart, the Chikou span or am I looking at the chart incorrectly.
Thank you for your time.
@rockbusiness If you specify what you are looking to plot maybe someone on the forum will code it for you. I know nothing of Ichimoku but spent the last five minutes reading on the "chinku span" (also seen it written as "chikou" ) which seems to be the Plot of the Close just lagged by a number of bars - often 26.
So maybe something like this added to the default chart?
ChinkuShift = Param("Chinku Shift", 26, 10, 50, 1);
Chinku = C;
Plot(Chinku , "", colorWhite, styleDashed, Null, Null ,-ChinkuShift );
You may of course choose color and style that suits your taste.
Hi portfoliobuilder,
Thank you a lot. Your example was just spot on. I knew about Amibroker just about a week ago and started to use it. I knew about AFL just two days ago so I didn't knew it could be this flexible. Here's what I did.
The original code that ships with Amibroker for ichimoku
prds = Param( "Standard Line Periods", 13, 5, 26, 1 );
turn = Param( "Turning Line Periods", 3, 3, 10, 1 );
delay = Param( "Delayed Line Periods", 12, 4, 25, 1 );
span = Param( "Spans Periods", 16, 10, 52, 1 );
TL = ( HHV( H, turn ) + LLV( L, turn ) ) / 2;
SL = ( HHV( H, prds ) + LLV( L, prds ) ) / 2;
DL = Ref( C, delay );
Sp1 = ( SL + TL ) / 2;
Sp2 = ( HHV( H, span ) + LLV( L, span ) ) / 2;
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorDefault, styleNoTitle | GetPriceStyle() );
Plot( SL, "SL", colorRed, styleThick | styleNoLabel );
Plot(DL,"Close",colorBrown,styleDashed | styleNoLabel);
Plot( TL, "TL", colorGreen, styleThick | styleNoLabel );
color = IIf( Sp1 > Sp2, ParamColor( "Span1 Color", ColorRGB( 0, 255, 0 ) ), ParamColor( "Span2 Color", ColorRGB( 255, 104, 32 ) ) );
PlotOHLC ( Sp1, Sp1, Sp2, Sp2, "Cloud", Color, styleCloud | styleNoLabel, Null, Null, delay, -2 );
I edited it as following
prds = Param( "Standard Line Periods", 13, 5, 26, 1 );
turn = Param( "Turning Line Periods", 3, 3, 10, 1 );
delay = Param( "Delayed Line Periods", 12, 4, 25, 1 );
span = Param( "Spans Periods", 16, 10, 52, 1 );
TL = ( HHV( H, turn ) + LLV( L, turn ) ) / 2;
SL = ( HHV( H, prds ) + LLV( L, prds ) ) / 2;
DL = Ref( C, delay );
Sp1 = ( SL + TL ) / 2;
Sp2 = ( HHV( H, span ) + LLV( L, span ) ) / 2;
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorDefault, styleNoTitle | GetPriceStyle() );
Plot( SL, "SL", colorRed, styleThick | styleNoLabel );
//Added this line for chikou span
Plot(DL,"Close",colorBrown,styleDashed | styleNoLabel,Null,Null,-delay);
Plot( TL, "TL", colorGreen, styleThick | styleNoLabel );
color = IIf( Sp1 > Sp2, ParamColor( "Span1 Color", ColorRGB( 0, 255, 0 ) ), ParamColor( "Span2 Color", ColorRGB( 255, 104, 32 ) ) );
PlotOHLC ( Sp1, Sp1, Sp2, Sp2, "Cloud", Color, styleCloud | styleNoLabel, Null, Null, delay, -2 );
Now I have the chikou span line. But as a noob I am not sure if I did it correctly. Forgive me if I sound like I am asking you to be a personal army. Did I do it correctly ?
My output looks like in the picture with the brown dashed line
Found that my above answer elongates the chikou span horizontally. I have edited the code which produces correct result.
prds = Param( "Standard Line Periods", 13, 5, 26, 1 );
turn = Param( "Turning Line Periods", 3, 3, 10, 1 );
delay = Param( "Delayed Line Periods", 12, 4, 25, 1 );
span = Param( "Spans Periods", 16, 10, 52, 1 );
TL = ( HHV( H, turn ) + LLV( L, turn ) ) / 2;
SL = ( HHV( H, prds ) + LLV( L, prds ) ) / 2;
DL = Ref( C, delay );
Sp1 = ( SL + TL ) / 2;
Sp2 = ( HHV( H, span ) + LLV( L, span ) ) / 2;
Chinku = C;
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorDefault, styleNoTitle | GetPriceStyle() );
Plot( SL, "SL", colorRed, styleThick | styleNoLabel );
Plot(Chinku , "", colorWhite, styleDashed, Null, Null ,-delay);
Plot( TL, "TL", colorGreen, styleThick | styleNoLabel );
color = IIf( Sp1 > Sp2, ParamColor( "Span1 Color", ColorRGB( 0, 255, 0 ) ), ParamColor( "Span2 Color", ColorRGB( 255, 104, 32 ) ) );
PlotOHLC ( Sp1, Sp1, Sp2, Sp2, "Cloud", Color, styleCloud | styleNoLabel, Null, Null, delay, -2 );
@rockbusiness, glad to see you making progress.
In the latest code posted, I noticed that the Plot of the DL show the same name “Close” as the plot of the Close.
As a newbie to AFL, you may not realize that the name section will typically appear in your title line. You can see that you have 2 (two) Closes listed in your title. Might be confusing when you come back to it… Hint Hint (Change the name on the DL plot).
As for is it working properly? I don’t really work with Ichimoku enough to be able to say. If you are learning it, check to see if you can find an example and match it up.
In your last version, you Plot the Chinku with a delay. In your previous post with plotting the DL, you Also added the delay to it. But, since DL was already delayed, it (probably) would have worked perfectly for you if you had not put in the “-delay” in the plot statement.
I hope that you understand this, and that it is helpful. It looks to me that you are making progress on the AFL learning.
Way to go!
Hi snoopy,
Thank you for your feedback. I have changed the code as you suggested. The code is as below
prds = Param( "Standard Line Periods", 26, 5, 26, 1 );
turn = Param( "Turning Line Periods", 9, 3, 10, 1 );
delay = Param( "Delayed Line Periods", 26, 4, 26, 1 );
span = Param( "Spans Periods", 52, 10, 52, 1 );
TL = ( HHV( H, turn ) + LLV( L, turn ) ) / 2;
SL = ( HHV( H, prds ) + LLV( L, prds ) ) / 2;
DL = C;
Sp1 = ( SL + TL ) / 2;
Sp2 = ( HHV( H, span ) + LLV( L, span ) ) / 2;
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorDefault, styleNoTitle | GetPriceStyle() );
Plot( SL, "SL", colorRed, styleThick | styleNoLabel );
Plot(DL , "DL", colorWhite, styleDashed, Null, Null,-delay);
Plot( TL, "TL", colorGreen, styleThick | styleNoLabel );
color = IIf( Sp1 > Sp2, ParamColor( "Span1 Color", ColorRGB( 0, 255, 0 ) ), ParamColor( "Span2 Color", ColorRGB( 255, 104, 32 ) ) );
PlotOHLC ( Sp1, Sp1, Sp2, Sp2, "Cloud", Color, styleCloud | styleNoLabel, Null, Null, delay );
As you said DL was already delayed but if I don't put -delay than it just wont get delayed. If I put -delay while plotting but remove from DL assignment it will just create a straight line upto that delayed point. I don't know why. The above code worked perfectly and gave the following output. I have checked with other codes and it looks ok. Thank again to @snoopy.pa30 and @portfoliobuilder for your help.
Hello friends .
Someone can help with the Trend Line in ichimoku