Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

Ichimoku Cloud AFL code

1 min read

This tutorial talks about how to plot Ichimoku cloud charts in Amibroker for any kind of timeframe. Here only the cloud is plotted and can be used as a trend following trading system.


[wp_ad_camp_5]

Ichimoku Cloud Charts – Amibroker AFL Code

_SECTION_BEGIN("Ichimoku Cloud Charts");
GraphXSpace =1;
prds = Param("Standard Line Periods?", 13,5,26,1);
prds1 = Param("Turning Line Periods?", 3,3,10,1);
prds2 = Param("Delayed Line Periods?", 12,4,25,1);
prds3 = Param("Spans Periods?", 16,10,52,1);
TL = ( HHV( H, prds1) + LLV( L, prds1) )/2;
SL = ( HHV( H, prds) + LLV( L, prds) )/2;
DL = Ref( C, prds2);
Sp1 = Ref( ( SL + TL )/2, -prds2);
Sp2 = Ref( (HHV( H, prds3) + LLV(L, prds3))/2, -prds2);
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{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", colorBlack, styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );
if ( ParamToggle( "Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip = StrFormat( "Open: %g
High: %g
Low: %g
Close: %g (%.1f%%)
Volume: " + NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
}
PlotOHLC (Sp1,Sp1,Sp2,Sp2,"Cloud",IIf(Sp1>Sp2,ParamColor("Span1 Color", ColorRGB(0,255,0)),ParamColor("Span2 Color",ColorRGB(255,104,32))),styleCloud);
_SECTION_END();

Ichinoku plays a major role in high probability trend following. The default parameter used in this afl code is 3,13,16.

I prefer to use the cloud charts as the trailing stoploss for my trades. If there is a upward breakout /downside breakdown then long/short positons need to be taken accordingly. Sample Nifty Weekly chart shown with 10 years of Ichimoku cloud chart. Check how it plays a major role in taking trend decisions. If you are a regular investor/trader in this market then you should keep eye on this fruitful strategy

Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

[Live Coding Webinar] Build Your First Trading Bridge for…

In this course, you will be learning to build your own trading bridge using Python. This 60-minute session is perfect for traders, Python enthusiasts,...
Rajandran R
1 min read

[Webinar] Understanding and Mitigating Curve Fitting in System Trading

"Understanding and Mitigating Curve Fitting in System Trading"! This dynamic session aims to equip novice to intermediate traders, quantitative analysts, and financial engineers with...
Rajandran R
1 min read

P-Signal Strategy Long Only Strategy – Amibroker AFL Code

This tutorial provides an overview of the P-Signal reversal strategy, a quantitative trading strategy that utilizes statistical parameters and error functions to generate probabilistic...
Rajandran R
2 min read

22 Replies to “Ichimoku Cloud AFL code”

  1. Dear Rajandran,

    Thanks a lot. Is there any specific reasoning of tinkering with parameters….normal ichimoku has standard set of 9,12,26 i beleive (indirectly reflects MACD)

    Anyway, great appreciation for this

    sri

  2. I feel 3,13,16 is more optimized when compared to the standard parameters 9,25,52
    which uses bigger timeduration and also the cloud bandwidth is much higher in the standard parameter whereas in case of 3,13,16 the cloud bandwidth is much thinner and also more optimized to trade with nifty

  3. Dear Sir,

    i read at no of places in technical reports that daily trend of a stock has turned up or down. weekly trend is in down trend since last x weeks. how it is decided that trend has changed from down to up or from up to down?

    it is decided by looking at higher low and higher high pattern or by crossing a particular mov avg or by pivot calculator?

    will u please explain?

    Bhavesh Shah

  4. Bhavesh,
    It depends upon which strategy they are adopting. There are huge number of trading strategies in this trading world. Some one uses momentum indicators, ADX, MACD indicators and some one may use stuff like GANN, Elliot Wave… basically they have set of guidlines and frame the rules for Buy/Sell Signal when to cover, Which time frame to look before getting into the entry/exit, What should be the stop loss for the trade. After framing such set of rules and regulations for their they will decide which side to trade and most of them predict for higher levels if their set of rules indicate a buy signal

  5. Dear Sir,
    How can we add conditions for buy/sell signals to this AFL?. Will u please explain if possible?

    thanks & regds,

    Sripal

  6. i ManshiRT how to get data from 2008 to till now i only backfill 15 days data how to get 365 days tell me Rajendran sir ,
    i have already database in mydata in other database yahoo intraday manshiRT the data show me 15 only but i have data from 2008 to till plz mail [email protected]

  7. part2 (mydatabase)i ManshiRT how to get data from 2008 to till now i only backfill 15 days data how to get 365 days tell me Rajendran sir ,
    i have already database in mydata in other database yahoo intraday manshiRT the data show me 15 only but i have data from 2008 to till plz mail [email protected]

  8. i ManshiRT how to get data from 2008 to till now i only backfill 15 days data how to get 365 days tell me Rajendran sir ,
    i have already database in mydata in other database yahoo intraday manshiRT the data show me 15 only but i have data from 2008 to till plz mail me [email protected]

  9. Hi Rajandran,

    I must say your posted information, if utilised in right direction can give very good results.

    In regards to “Ichimoku Clouds” — the formula you have posted, can you please guide me that – How can I Insert this formula into my Amibroker Software, so that I can also have similar chart with “Ichimoku Cloud”…

    I’ve recently downloaded the Ami Software, so I dont’ve very good hand on it.

    Many Thanks..

    1. Save the file ichimoku.afl under the folder c:\program files\amibroker\formula\custom

      Now Open Amibroker->Select VIEW from the menu->Select CHARTS

      a left side pane opens from there go to the custom folder and select ichimoku

      Its done

  10. Hi,

    Thanks for advising. Here I can only copy the formula.

    From where I can download it as a file in .afl format?

    Thanks & Regards,

  11. Thanks Buddy… Finally I got the success in inserting Ichimoku formula…

    And yes, your yesterday’s Ichimoku post @ISM saved me… I made exit from Longs when @ Around 2pm – 2nd hourly candle failed to come over 5154…

    Thanks for ur suggestion n support…

    Now I just need to purchase Data from TDI… and i’m all set..

  12. mr rajandran sir how to delete and insert this ichimoku indicater time and again when i wish on the chart.

  13. sir how to insert this ichimoku formula in custom folder as afl file. i can only manage it save as atext file so how to convert it to afl file

  14. ok let me try but main question is wheather it will work in trial version of ami.
    sir pls arrange this valuable formula as afl file so to download and insert easily. and lastly give instruction to newbies how to insert and use this afl.
    e.g if i insert ichimoku as overlay how can i delete and reinsert etc.
    it will be helpfull for ami newbies like me. any way thanks for posts . pls continue

  15. Mr, rajendran ,will you please make the space between spanA and spanB Histogram instead of cloud in the fallowing ichimoku afl.

  16. Mr. rajendran, will you please change the cloud as Histogram in the fallowing ichimoku afl.

    _SECTION_BEGIN(“U.ichi kimko hyo.”);
    //=======================================================================
    SetChartOptions(0,chartShowArrows|chartShowDates);
    _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”, ParamColor(“Color”, colorBlack ), styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );
    if( ParamToggle(“Tooltip shows”, “All Values|Only Prices” ) )
    {
    ToolTip=StrFormat(“Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: “+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
    }

    SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
    TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
    DL = Ref( C, 26 );
    Span1 = (( SL + TL )/2);
    Span2 = (HHV( H, 52) + LLV(L, 52))/2;

    Plot(SL,”SL”,21,styleLine); // standard, base, or kijun-sen line
    Plot(TL,”TL”,32,styleLine); // turning, conversion, or tenkan-sen line
    Plot(DL,””,colorViolet,styleLine); // delayed, lagging, or chikou span
    Plot(Span1,””,colorSeaGreen,1,0,0,26); // senkou span A, kumo, or white clouds
    Plot(Span2,””,colorSeaGreen,1,0,0,26); // senkou span B, kumo, or white clouds
    PlotOHLC(Span1,Span2,Span1,Span2,””,IIf(Span1>Span2,8,9),styleCloud|4096,0,0,26);

    Buy = Cross(TL,SL);
    Sell = Cross(SL,TL);
    shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
    PlotShapes(shape,IIf(Buy,colorDarkGreen,colorRed), 0,IIf(Buy,Low,High));

    //==========================================================
    _SECTION_END();

  17. Hi ..

    Is there a way u can created a mt4 n 5 for this indicator.I am new in forex.But i do read a lot and still learning .

    1. Rajandran
      please try to post an afl code for following logic.

      chart m15
      ichimoku
      plot a ribbon for m15 tf and m30 tf price above cloud green dot price below cloud red dot and nothing if price is inside cloud
      i mean we have m15 ichimoku chart with two ribbons at bottom one ribbon for m15 and one for m30
      thank you

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More