# Coral Indicator in tradescript

**URL:** https://tradingqna.com/t/coral-indicator-in-tradescript/9737
**Category:** Algos, strategies, code
**Created:** [February 16, 2017, 3:49pm UTC](https://tradingqna.com/t/coral-indicator-in-tradescript/9737 "2017-02-16T15:49:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![harishisat](https://tradingqna.com/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@harishisat](https://tradingqna.com/u/harishisat)
#### Post date: [February 16, 2017, 3:49pm UTC](https://tradingqna.com/t/coral-indicator-in-tradescript/9737/1 "2017-02-16T15:49:07Z")

</div>

Hi,  
I have afl code below, i want in tradescript can somebody help me out. below is the code.

// Coded by Rajandran R  
// Transcoded from PineScript Indicator (Coral Trend)  
// Date : 20th Dec 2015

\_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();

---

<div class="post-metadata">

### Author: ![pr0461](https://tradingqna.com/user_avatar/tradingqna.com/pr0461/32/46899_2.png) [@pr0461](https://tradingqna.com/u/pr0461)
#### Post date: [February 17, 2017, 8:01am UTC](https://tradingqna.com/t/coral-indicator-in-tradescript/9737/2 "2017-02-17T08:01:45Z")

</div>

Sorry if i am oversimplifying, but this looks too similar to supertrend. have you tried supretrend and modifying it’s parameters… i have a feelign it could give similar results!

---

<div class="post-metadata">

### Author: ![harishisat](https://tradingqna.com/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@harishisat](https://tradingqna.com/u/harishisat)
#### Post date: [February 17, 2017, 3:35pm UTC](https://tradingqna.com/t/coral-indicator-in-tradescript/9737/3 "2017-02-17T15:35:43Z")

</div>

Thank you, but if you can write an tradescript code it will be great support to me.

---

<div class="post-metadata">

### Author: ![pr0461](https://tradingqna.com/user_avatar/tradingqna.com/pr0461/32/46899_2.png) [@pr0461](https://tradingqna.com/u/pr0461)
#### Post date: [March 3, 2017, 6:37am UTC](https://tradingqna.com/t/coral-indicator-in-tradescript/9737/4 "2017-03-03T06:37:53Z")

</div>

I have never used it before. Let me check and revert back. Please remind me by tomorrow if you can.

---

<div class="post-metadata">

### Author: ![harishisat](https://tradingqna.com/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@harishisat](https://tradingqna.com/u/harishisat)
#### Post date: [March 4, 2017, 7:30am UTC](https://tradingqna.com/t/coral-indicator-in-tradescript/9737/5 "2017-03-04T07:30:20Z")

</div>

Hi,  
You asked me to remind, kindly do the needful

---

<div class="post-metadata">

### Author: ![pr0461](https://tradingqna.com/user_avatar/tradingqna.com/pr0461/32/46899_2.png) [@pr0461](https://tradingqna.com/u/pr0461)
#### Post date: [March 4, 2017, 4:37pm UTC](https://tradingqna.com/t/coral-indicator-in-tradescript/9737/6 "2017-03-04T16:37:41Z")

</div>

I haven’t been able to find the formula on google for the coral indicator, only afl code is available. And I am not familiar with afl. If you could find the formula for it, we could give it a try.
