Which ALF is this?

#3
Namaste Sudhaji
This is some robo afl and in another picture I could see the name like robo or something.
Must be an automated system. Wonder from where we can get this.
 
#7
// Automatic Linear Trend Channel (edited)
// original author Edward Pottasch
// Trend is defined using code found on the net
// see also: http://www.youtube.com/watch?v=HWPSqwEkN64
// Amibroker AFL code by Edward Pottasch, November 2011
// edited by Anderson Wilson, July 2012
// some symbols makes yybull and yybear infinite,
// added IsFinite(yybull) AND IsFinite(yybear)
// before plotting Channel
_SECTION_BEGIN("Parameters");
kk = Optimize( "mult", Param( "mult", 1.25, 0.25, 8, 0.25 ), 1, 8, 0.25 );
Per = Optimize( "period", Param( "period", 10, 1, 300, 1 ), 5, 300, 1 );
sdfact = Param( "Standard Deviation Factor", 2, 0.5, 5, 0.1 );
offset = Param( "Offset", 2, 1, 50, 1 );
tc = ParamList( "Channel Display", List = "No Channel|Channel|ChannelRT|Both
Channels", 1 );
ms = ParamToggle( "Trend", "Regular|Smoothed", 1 );

x = Cum( 1 );
HaClose = ( O + H + L + C ) / 4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );

if ( ms == 0 )
{
nm = ( H - L );
j = ( O + H + L + C ) / 4;
}
else
{
nm = ( HaHigh - HaLow );
j = ( HaOpen + HaHigh + HaLow + HaClose ) / 4;
}

rfsctor = WMA( nm, Per );

revers = kk * rfsctor;
Trend = 1;
NW[0] = 0;

for ( i = 1;i < BarCount;i++ )
{
if ( Trend[i-1] == 1 )
{
if ( j < NW[i-1] )
{
Trend = -1;
NW = j + Revers;
}
else
{
Trend = 1;

if ( ( j - Revers ) > NW[i-1] )
{
NW = j - Revers;
}
else
{
NW = NW[i-1];
}
}
}

if ( Trend[i-1] == -1 )
{
if ( j > NW[i-1] )
{
Trend = 1;
NW = j - Revers;
}
else
{
Trend = -1;

if ( ( j + Revers ) < NW[i-1] )
{
NW = j + Revers;
}
else
{
NW = NW[i-1];
}
}
}
}

cp = ( H + L ) / 2;

TrendUp = IIf( Trend == 1, Trend, 0 );
TrendDown = IIf( Trend == -1, Trend, 0 );
totalTrend = IIf( TrendUp, TrendUp, TrendDown );
dtotalTrend = totalTrend - Ref( totalTrend, -1 );
vtotalTrend = ValueWhen( dtotalTrend, dtotalTrend );
cbull = vtotalTrend > 0 AND Ref( vtotalTrend, -1 ) < 0;
cbull = Ref( cbull, 1 );
cbear = vtotalTrend < 0 AND Ref( vtotalTrend, -1 ) > 0;
cbear = Ref( cbear, 1 );
cbull = vtotalTrend > 0 AND Ref( vtotalTrend, -1 ) < 0;
cbull = Ref( cbull, 1 );
cbull[BarCount-1] = 1;
cbear = vtotalTrend < 0 AND Ref( vtotalTrend, -1 ) > 0;
cbear = Ref( cbear, 1 );
cbear[BarCount-1] = 1;
nwbull = Ref( Flip( cbull, cbear ), -1 );
nwbear = Ref( Flip( cbear, cbull ), -1 );

xxbull = BarsSince( cbull );
xxbull[BarCount-1] = xxbull[BarCount-2] + 1;
aaabull = LinRegIntercept( cp, xxbull );
bbbbull = LinRegSlope( cp, xxbull );
daabull = Ref( ValueWhen( cbear, aaabull, 0 ), -1 );
dbbbull = Ref( ValueWhen( cbear, bbbbull, 0 ), -1 );
yybull = daabull + dbbbull * ( xxbull - 1 );
yybull = IIf( xxbull > Max( offset, 1 ), yybull, Null );
wdbull = sdfact * StdErr( cp, xxbull );
wdbull = Ref( ValueWhen( cbear, wdbull, 0 ), -1 );

xxbear = BarsSince( cbear );
xxbear[BarCount-1] = xxbear[BarCount-2] + 1;
aaabear = LinRegIntercept( cp, xxbear );
bbbbear = LinRegSlope( cp, xxbear );
daabear = Ref( ValueWhen( cbull, aaabear, 0 ), -1 );
dbbbear = Ref( ValueWhen( cbull, bbbbear, 0 ), -1 );
yybear = daabear + dbbbear * ( xxbear - 1 );
yybear = IIf( xxbear > Max( offset, 1 ), yybear, Null );
wdbear = sdfact * StdErr( cp, xxbear );
wdbear = Ref( ValueWhen( cbull, wdbear, 0 ), -1 );

llbull = LinearReg( cp, xxbull );
llbull = IIf( xxbull > Max( Offset, 1 ), llbull, Null );
llbullp = LinearReg( cp, xxbull ) + sdfact * StdErr( cp, xxbull );
llbullp = IIf( xxbull > Max( Offset, 2 ), llbullp, Null );
llbullm = LinearReg( cp, xxbull ) - sdfact * StdErr( cp, xxbull );
llbullm = IIf( xxbull > Max( Offset, 2 ), llbullm, Null );
llbear = LinearReg( cp, xxbear );
llbear = IIf( xxbear > Max( Offset, 1 ), llbear, Null );
llbearp = LinearReg( cp, xxbear ) + sdfact * StdErr( cp, xxbear );
llbearp = IIf( xxbear > Max( Offset, 2 ), llbearp, Null );
llbearm = LinearReg( cp, xxbear ) - sdfact * StdErr( cp, xxbear );
llbearm = IIf( xxbear > Max( Offset, 2 ), llbearm, Null );

SetChartBkColor( ParamColor( "Background Color", colorBlack ) );
SetChartOptions( 0, chartShowDates );
SetBarFillColor( IIf( C > O, ParamColor( "Candle UP Color", colorGreen ), IIf(
C <= O, ParamColor( "Candle Down Color", colorRed ), colorLightGrey ) ) );
Plot( C, "Price", IIf( C > O, ParamColor( "Wick UP Color", colorDarkGreen ),
IIf( C <= O, ParamColor( "Wick Down Color", colorDarkRed ), colorLightGrey ) ),
64, 0, 0, 0, 0 );
PlotShapes( IIf( x == BarCount, shapeSmallSquare, shapeNone ), colorWhite, 0,
j, 0 );
Plot( IIf( NW < j, NW, Null ), "\ntrailLong", ParamColor( "ColorTrailLong",
colorGreen ), styleStaircase | styleDots );
Plot( IIf( NW > j, NW, Null ), "\ntrailShort", ParamColor( "ColorTrailShort",
colorRed ), styleStaircase | styleDots );


Buy = trend==1; Sell = trend==-1;
Buy = ExRem(Buy,Sell); Sell = ExRem(Sell,Buy);
PlotShapes(Buy+2*Sell, colorBrightGreen, 0,IIf(Buy,L,H),-30);


switch ( tc )
{
case( "No Channel" ):
break;
case( "Channel" ):
Plot( IIf( nwbull AND IsFinite(yybull), yybull, Null ), "", bbb = ColorRGB(
0, 255, 0 ), styleDashed );
Plot( IIf( nwbull AND IsFinite(yybull), yybull + wdbull, Null ), "", bbb,
styleThick );
Plot( IIf( nwbull AND IsFinite(yybull), yybull - wdbull, Null ), "", bbb,
styleThick );
Plot( IIf( nwbear AND IsFinite(yybear), yybear, Null ), "", sss =
ColorRGB( 255, 0, 0 ), styleDashed );
Plot( IIf( nwbear AND IsFinite(yybear), yybear + wdbear, Null ), "", sss,
styleThick );
Plot( IIf( nwbear AND IsFinite(yybear), yybear - wdbear, Null ), "", sss,
styleThick );
PlotOHLC( IIf( nwbull AND IsFinite(yybull), yybull + wdbull, Null ),
IIf( nwbull AND IsFinite(yybull), yybull + wdbull, Null ),
IIf( nwbull AND IsFinite(yybull), yybull - wdbull, Null ),
IIf( nwbull AND IsFinite(yybull), yybull - wdbull, Null ),
"", ColorRGB( 10, 15, 10 ), styleCloud | styleNoLabel, 0, 0, 0, -1 );
PlotOHLC( IIf( nwbear AND IsFinite(yybear), yybear + wdbear, Null ),
IIf( nwbear AND IsFinite(yybear), yybear + wdbear, Null ),
IIf( nwbear AND IsFinite(yybear), yybear - wdbear, Null ),
IIf( nwbear AND IsFinite(yybear), yybear - wdbear, Null ),
"", ColorRGB( 15, 10, 10 ), styleCloud | styleNoLabel, 0, 0, 0, -1 );

_N(Title = VarGetText("Title") +
StrFormat(
", nwbull %g, yybull %g, nwbear %g, yybear %g wdbull %g",
nwbull, yybull, nwbear, yybear, wdbull

)
);
break;
case( "ChannelRT" ):
Plot( IIf( nwbull, llbull, Null ), "", colorGreen, styleDashed,
0, 1, 0, 1 );
Plot( IIf( nwbull, llbullp, Null ), "", colorGreen, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbull, llbullm, Null ), "", colorGreen, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbear, llbear, Null ), "", colorRed, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbear, llbearp, Null ), "", colorRed, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbear, llbearm, Null ), "", colorRed, styleDashed, 0, 1, 0, 1
);
PlotOHLC( IIf( nwbull, llbullp, Null ), IIf( nwbull, llbullp, Null ), IIf(
nwbull, llbullm, Null ),
IIf( nwbull, llbullm, Null ), "", ColorRGB( 10, 15, 10 ),
styleCloud | styleNoLabel, 0, 0, 0, -1 );
PlotOHLC( IIf( nwbear, llbearp, Null ), IIf( nwbear, llbearp, Null ), IIf(
nwbear, llbearm, Null ),
IIf( nwbear, llbearm, Null ), "", ColorRGB( 15, 10, 10 ),
styleCloud | styleNoLabel, 0, 0, 0, -1 );
break;
case( "Both Channels" ):
Plot( IIf( nwbull, yybull, Null ), "", bbb = ColorRGB( 0, 255,
0 ), styleLine );
Plot( IIf( nwbull, yybull + wdbull, Null ), "", bbb, styleThick );
Plot( IIf( nwbull, yybull - wdbull, Null ), "", bbb, styleThick );
Plot( IIf( nwbear, yybear, Null ), "", sss = ColorRGB( 255, 0, 0 ),
styleLine );
Plot( IIf( nwbear, yybear + wdbear, Null ), "", sss, styleThick );
Plot( IIf( nwbear, yybear - wdbear, Null ), "", sss, styleThick );
Plot( IIf( nwbull, llbull, Null ), "", colorGreen, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbull, llbullp, Null ), "", colorGreen, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbull, llbullm, Null ), "", colorGreen, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbear, llbear, Null ), "", colorRed, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbear, llbearp, Null ), "", colorRed, styleDashed, 0, 1, 0, 1
);
Plot( IIf( nwbear, llbearm, Null ), "", colorRed, styleDashed, 0, 1, 0, 1
);
break;

}

_SECTION_END();
 
#9
a=20;
GraphXSpace=5;
p=30;
p = Param("p",30,2,100,1);

Om=DEMA(O,p);
hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );

slope = Param("slope",2,2,100,1);

Color20= IIf(LinRegSlope(MA(HaClose,a),slope)<0,colorRed,colorGreen);
Plot(MA(HaClose,a),"", color20,styleThick);

Color=IIf(Haclose>MA(HaClose,a),colorGreen, colorRed);
PlotOHLC( HaOpen, HaOpen, HaClose, HaClose, "" + Name(), Color, styleCandle);
_SECTION_END();

_SECTION_BEGIN("Priyanvada's Price Action");
P = ParamField( "Price field" );
CandleT=ParamToggle("Candlestick Display","No|Yes",defaultval=1 );
BarT=ParamToggle("Bar Display","No|Yes",defaultval=0 );
LineT=ParamToggle("Line Display","No|Yes",defaultval=0 );
//T3MA toggle
T3MAT=ParamToggle("Moving Average","No|Yes",defaultval=1 );
//T3MA Check Periods
T3MAP = Param("T3MA Periods", 46, 2, 300, 1, 10 );

function T3(price,periods)
{
s = 0.84;
e1=EMA(price,periods);
e2=EMA(e1,Periods);
e3=EMA(e2,Periods);
e4=EMA(e3,Periods);
e5=EMA(e4,Periods);
e6=EMA(e5,Periods);
c1=-s*s*s;
c2=3*s*s+3*s*s*s;
c3=-6*s*s-3*s-3*s*s*s;
c4=1+3*s+s*s*s+3*s*s;
Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
return ti3;
}
T3MA = T3(P,T3MAP);
for( i = 1; i < BarCount; i++ )
{
//assignments
NvadaOpen = Close[i-1];
NvadaClose=Close;
NvadaHigh=IIf(NvadaOpen>=NvadaClose,NvadaOpen,NvadaClose);
NvadaLow=IIf(NvadaOpen>=NvadaClose,NvadaClose,NvadaOpen);
averagechange=(NvadaOpen+NvadaClose)/2;

//=============================
//CHECKS

//check1= uptrend and upbar as referred for last 2 bars
Check1=averagechange>T3MA AND NvadaClose>=NvadaOpen[i-2];
//check2= uptrend and downbar as referred for last 2 bars
Check2=averagechange>T3MA AND NvadaClose<NvadaOpen[i-2];

//check3= downtrend and downbar as referred for last 2 bars
Check3=averagechange<T3MA AND NvadaClose<=NvadaOpen[i-2];
//check4= downtrend and upbar as referred for last 2 bars
Check4=averagechange<T3MA AND NvadaClose>NvadaOpen[i-2];

//check5=check2 or check 4 => possible corrections!
Check5=Check2 OR Check4;

//Color assignment
if(Check1==1){pricolor =colorGreen;}
if(Check3==1){pricolor =colorRed;}
if(Check5==1){pricolor =colorYellow;}
//Pricolor = IIf(NvadaClose>Ref(NvadaOpen,-2),colorGreen,colorRed);
}



//T3MA Display
if(T3MAT==1)
{
T3MAcolor = IIf(C>=T3MA,colorGreen,colorRed);
Plot(T3MA,"T3MA",T3MAcolor,styleThick);
}
Buy=T3MAcolor==colorGreen;
Sell=T3MAcolor==colorRed;
Short=Sell;
Cover=Buy;

Cover=ExRem(Cover,Short);
Short=ExRem(Short,Cover);

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
PlotShapes(IIf(Buy , shapeUpArrow, shapeNone),colorWhite);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorYellow);
no=Param( "Swing", 12, 1, 55 );
tsl_col=ParamColor( "Color", colorLightGrey );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);


Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase);




SetPositionSize(300,spsShares);
ApplyStop(0,1,10,1);
//-----------end--------------
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy);

BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);


Edc=(
WriteIf (Buy AND Ref(shrt,-1), " BUY @ "+C+" ","")+
WriteIf (Sell AND Ref(Long,-1), " SEll @ "+C+" ","")+
WriteIf(Sell , "Last Trade Profit Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Last Trade Profit Rs."+(SellPrice-C)+"",""));
_SECTION_END();


H1 = SelectedValue( TimeFrameGetPrice( "H", inDaily, -1 ) );
L1 = SelectedValue( TimeFrameGetPrice( "L", inDaily, -1 ) );
C1 = SelectedValue( TimeFrameGetPrice( "C", inDaily, -1 ) );
H2 = SelectedValue( TimeFrameGetPrice( "H", inDaily, 0 ) );
L2 = SelectedValue( TimeFrameGetPrice( "L", inDaily, 0 ) );
O1 = SelectedValue( TimeFrameGetPrice( "open", inDaily, 0 ) );
F4 = 0;
D1 = ( H1 - L1 );
D2 = ( H2 - L2 );
F1 = D1 * 0.433;
F2 = D1 * 0.766;
F3 = D1 * 1.35;
if ( D2 <= F1 )
F4 = F1;
else
if ( D2 <= F2 )
F4 = F2;
else
F4 = F3;

S_P = ( O1 - F4 );

B_P = ( O1 + F4 );

BP = ( L2 + F4 );

BPTGT = ( BP + ( BP * .0065 ) );//.0015 brokerage

BPSTPLS = ( BP - ( BP * .0085 ) );

SP = ( H2 - F4 );

SPTGT = ( SP - ( SP * .0065 ) );

SPSTPLS = ( SP + ( SP * .0085 ) );


p = ( H1 + L1 + C1 ) / 3;

s1 = ( H1 );

r1 = ( L1 );

r2 = SelectedValue( L2 );

s2 = SelectedValue( H2 );
Filter = Buy OR Sell;

AddColumn( IIf( Buy, 66, 1 ), "Buy", formatChar, 1, bkcolor = IIf( Buy, 43, 33 ) );

AddColumn( IIf( Sell, 83, 1 ), "Sell", formatChar, 1, bkcolor = IIf( Sell, 25, 32 ) );

AddColumn( IIf( Short, 83, 1 ), "Short", formatChar, 1, bkcolor = IIf( Short, 25, 32 ) );

AddColumn( C, "CMP", 1.2, colorDefault, colorLightBlue );

AddColumn( BP, "SELL PRICE", 1.2, colorDefault, colorGreen );

AddColumn( BPTGT, "TGT PRICE", 1.2, colorDefault, colorBrown );

AddColumn( BPSTPLS, "STPLS BUY", 1.2, colorDefault, colorRed );

AddColumn( p, "PIVOT", 1.2, colorDefault, colorYellow );

AddColumn( SPSTPLS, "STPLS SELL", 1.2, colorDefault, colorRed );

AddColumn( SP, "SELL PRICE", 1.2, colorDefault, colorGreen );

AddColumn( SPTGT, "TGT PRICE", 1.2, colorDefault, colorBrown );


AddColumn( H1, "PRE-HIGH" );

AddColumn( L1, "PRE-LOW" );

AddColumn( D1, "PRE-DIFF" );

AddColumn( F1, "0.433" );

AddColumn( F2, "0.766" );

AddColumn( F3, "1.35" );

AddColumn( H2, "D-HIGH" );

AddColumn( L2, "D-LOW" );

AddColumn( D2, "D-DIFF" );

AddColumn( F4, "SELECT FACT" );
_SECTION_END();
//============== TITLE ==============
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorGold)+ "K T S" + EncodeColor(colorRose)+" (" + Name() + ") " + EncodeColor(colorGold)+ Interval(2) +
" " + Date() +" " +" • Open "+WriteVal(O,1.000)+" • "+"Hi "+WriteVal(H,1.000)+" • "+"Lo "+WriteVal(L,1.000)+" • "+
"Close "+WriteVal(C,1.000)+" ("+WriteVal(C-Ref(C,-1),1,0)+" "+WriteVal((C-Ref(C,-1))*100/Ref(C,-1),1.1)+ "%) • Vol= "+ WriteVal(V,1.0)



+"\n"+EncodeColor(colorGrey50)+"------------------------------------------------------------------------------------------------------------"

+"\n"+EncodeColor(colorGold)+
WriteIf (Buy , "Signal: Go Long - Entry Price: "+WriteVal(C)+" - Traget: "+WriteVal((BuyPrice+tsl)+BuyPrice)
+" - StopLoss:"+WriteVal(tsl)+" "
,"")+


WriteIf (Sell , "Signal: Go Short - Entry Price: "+WriteVal(C)+" - Target: "+WriteVal((tsl-SellPrice)-SellPrice)+" - StopLoss:"+WriteVal(tsl)+" ","")+
EncodeColor(ColorRGB(111,208,255))+
WriteIf(Long AND NOT Buy, "Trade: Long - Entry Price: "+WriteVal((BuyPrice))+" - Profit: "+WriteVal((C-BuyPrice))+" "+EncodeColor(colorLime)+"Let your profit runs!","")+
WriteIf(shrt AND NOT Sell, "Trade: Short - Entry Price: "+WriteVal((SellPrice))+" - Profit: "+WriteVal((SellPrice-C))+" - "+EncodeColor(colorLime)+"Let your profit runs!","")

+"\n"+EncodeColor(colorGrey50)+"------------------------------------------------------------------------------------------------------------"
);

dist = 6*ATR(10);
dist1 = 6*ATR(10);
for( i = 0; i < BarCount; i++)
{
if( Buy )
{
PlotText( "Buy:" + C[ i ] + "\nT= " + tsl + "\nSL= " +((C-tsl)+C) , i, C[ i ]-dist, colorGreen, colorDarkOliveGreen );
}
if( Sell )
{
PlotText( "Sell:" + C[ i ] + "\nT= " + (C-(tsl-C)) + "\nSL= " +tsl, i, C[ i ]+dist1, colorRed, colorDarkOliveGreen );
}
}




/*Plot Ribbon */
Ribbon1=IIf( (C) >(tsl) ,colorWhite, IIf(( tsl )>( C ), colorOrange,colorYellow));
Plot(3, "Ribbon", Ribbon1, styleOwnScale| styleArea| styleNoLabel,-0.5,100);

_SECTION_END();

_SECTION_BEGIN("Background text");
BKswitch = ParamToggle("Background Color","On,Off");

OUTcolor = ParamColor("Outer Panel Color",colorTeal);
INUPcolor = ParamColor("Inner Panel Upper",colorDarkTeal);
INDNcolor = ParamColor("Inner Panel Lower",colorPlum);
TitleColor = ParamColor("Title Color ",colorBlack);

if (NOT BKswitch)
{
SetChartBkColor(OUTcolor); // color of outer border
SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
}

cx = Param( "cxposn", 0, 0, 1250, 1 );
cy = Param( "cyposn", 112, 0, 500, 1 );
GfxSelectFont( "Candara", 18, 98, False );
GfxSetBkColor( colorBlack );
GfxSetTextColor( colorWhite );
GfxTextOut( "L.T.P. " + C + " ", cx, cy );
 

lvgandhi

Well-Known Member
#10
Those who posted above codes, please use edit using advanced tab and you can find various symbols above your message and just put your cursor on # symbol, you will see help line indicating "Wrap
Code:
 tag around the text". Just click that and you will get code tag as shown above. You can put the code of afl in between tags. This will save trouble for viewers of your posts.