Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, 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. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Coral Trend Indicator – Amibroker AFL Code

1 min read

Nifty Future EOD charts
Coral Trend Indicator

[wp_ad_camp_5]

 

Coral Trend Indicator is yet another trend following indicator inspired by Tradingview Pinescript code. Code is designed to plot in PSAR style. Green color dots represent a bullish trend. and the red dots represent a bearish trend. Coral trend applied to Nifty EOD charts as shown in the above figure.

Looks like the system is quite popular in the MT4 platform among FX traders known as THV Coral. Whatever the code does is just the indication of the trend and not a complete system though. Do your homework if you would like to build some system on top of it.

Nifty Future 15min Charts
NF 15min

 

Amibroker AFL Code – Coral Trend Indicator

_SECTION_BEGIN("Coral Trend Indicator");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 


sm = Param("Smoothing Period",21,2,40,1);
cd = Param("Constant D",0.4,0.1,2,0.1);

SetBarsRequired(ceil(3.5 * sm)) ;   // minimum lookback required for stability //

di = (sm - 1.0) / 2.0 + 1.0;
c1 = 2 / (di + 1.0);
c2 = 1 - c1;
c3 = 3.0 * (cd * cd + cd * cd * cd);
c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd);
c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd;

src = Close;
i1=0;
i2=0;
i3=0;
i4=0;
i5=0;
i6=0;


for(i=1;i<BarCount;i++)
{

i1[i] = c1[i]*src[i] + c2[i]*i1[i-1];
i2[i] = c1[i]*i1[i] + c2[i]*i2[i-1];
i3[i] = c1[i]*i2[i] + c2[i]*i3[i-1];
i4[i] = c1[i]*i3[i] + c2[i]*i4[i-1];
i5[i] = c1[i]*i4[i] + c2[i]*i5[i-1];
i6[i] = c1[i]*i5[i] + c2[i]*i6[i-1];

}

bfr = -cd*cd*cd*i6 + c3*(i5) + c4*(i4) + c5*(i3);

color = IIf(bfr>Ref(bfr,-1),colorGreen,colorRed);

Plot(bfr,"Coral Trend Indicator", color,styleDots|styleNoLine|stylethick);


_SECTION_END();
Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, 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. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Line Trading – OpenAlgo Automation Module for Amibroker Users

The line Trading Automation tool is designed for Manual traders who want to perform level-based trade execution faster and also bring some advanced trade...
Rajandran R
55 sec read

Mini Certification Course on Algorithmic Trading

Welcome to the Mini Certification on Algorithmic Trading using Amibroker and OpenAlgo! This comprehensive 4-part series is designed to equip you with the knowledge...
Rajandran R
1 min read

Pivot Reversal Strategy – Tradingview Pinescript to Amibroker AFL…

Pivot Reversal Strategy is a popular in-built strategy in Tradingview Platform. Here I had attempted to convert the pinescript v5 to Amibroker AFL Code....
Rajandran R
3 min read

12 Replies to “Coral Trend Indicator – Amibroker AFL Code”

  1. Hi, I found in Ami 5.60.2 that when you zoom in to a chart the red and green dots are shifting. In such a case the indicator is not very reliable. Brgds, CArnot

  2. Hi,

    The download link gives the same code with repainting problem. Please update the link. Enjoy, CArnot.

  3. hello sir i am regular reader and follower of your AFL and POSTs lot of thanks
    sir my humble Request sir please prepaire to this AFL in to MULTI TIME FRAME ( Not MTF DashBoard ) means when we select 5 min chart but indicator play like 15 min s Data based , and 15 min chart like 60 min …………,
    sir i found like this supertrend in MQ4 but not in Amibroker so please ……………prepaire this AFL ( Coral Trend Indicator) in MTF i hope response possitively thankyou sir

  4. Yes It would be excellent if Coral can be coded for multi time frame.
    Which means the buy signal would be generated in 5 min chart when 15 min chart turns green and in reverse sell would be signalled in conjunction with 15 mind chart or 30 mins chart.
    Even if there is a way to notice coral trend higher time frame indicator in lower time frame it would be excellent.

  5. Not better use this function instead looping.

    function T3( Price, T3Periods, s )
    {
    e1 = AMA( Price, 2 / ( T3Periods + 1 ) );
    e2 = AMA( e1, 2 / ( T3Periods + 1 ) );
    e3 = AMA( e2, 2 / ( T3Periods + 1 ) );
    e4 = AMA( e3, 2 / ( T3Periods + 1 ) );
    e5 = AMA( e4, 2 / ( T3Periods + 1 ) );
    e6 = AMA( e5, 2 / ( T3Periods + 1 ) );
    C1 = -s ^ 3;
    C2 = 3 * s ^ 2 * ( 1 + s );
    C3 = -3 * s * ( s + 1 ) ^ 2;
    C4 = ( 1 + s ) ^ 3;
    T3Result = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;
    return T3Result;
    }

Leave a Reply

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