AFL s Old and New all !!

#21
dear sir

Thank you for your sharing, but i think U very kind if posting picture for each indicator. I often use S&R for RSI, but I can't fine the indicator to explore the break out or break down in RSI. Do u have it?

tks!
 

sr114

Well-Known Member
#22
the correct form of the afl is in the text file. only erors were the extra spaces which is removed.

(the afl by Isfandi is prep by VKI)

also screen shot is provided
 
Last edited:
#23
i can't see this afl in my amibroker 5.20 properly but when i OFF SUP/RES. lines from parameters i can see this afl properly IS THIS PROBLEM IN THIS AFL???? PLZ HELP ANSWER
 

rkkarnani

Well-Known Member
#26
As posted earlier, AFL's are in my archieve. I do not know their authenticty I also do not know if they are correct, so in case of errors please take assistance from other Members who are experts in creating AFL's
 

rkkarnani

Well-Known Member
#27
Thomas Demark Sequential!!

_SECTION_BEGIN("TD Systems");
// Parameters
ShowNumbers= ParamToggle("Show 1-8 Numbers","No|Yes", 1);
ShowTDPoints = ParamToggle("Show TD Points", "No|Yes", 1);
ShowTDST = ParamToggle("Show TD Setup Trend", "No|Yes", 1);
tdstsa = 0;
tdstba = 0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//********************************************** TD Points********************************************************************/
function TD_Supply()
{
return ( H > Ref(H, 1) AND H > Ref(H, -1) AND H > Ref(C, -2));
}
function TD_Demand()
{
return ( L < Ref(L, 1) AND L < Ref(L, -1) AND L < Ref(C, -2));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// *********************************************** TD Sequential************************************************************/
// *** Setup Buy Signal ***
//nine consecutive days closes less than the close four days earlier
Con = C < Ref( C, -4);
Buy9Bars = BarsSince(BarsSince(Con));
Buy9Signal = Buy9Bars == 9;

// *** Requirements ***
//The first day of the nine-day must be preceded by a close day immediately before it that is greater than OR equal to the Close four days earlier
Con = Ref(C, -9) >= Ref(C, -13);
Buy9Req = Buy9Signal AND Con;

// *** Intersection ***
// the high of either day 8 or day 9 is greater than or equal to the low three, four, five, six, OR seven days earlier
Con1 = (H >= Ref(L, -3)) OR ( Ref(H, -1) >= Ref(L, -3));
Con2 = (H >= Ref(L, -4)) OR ( Ref(H, -1) >= Ref(L, -4));
Con3 = (H >= Ref(L, -5)) OR ( Ref(H, -1) >= Ref(L, -5));
Con4 = (H >= Ref(L, -6)) OR ( Ref(H, -1) >= Ref(L, -6));
Con5 = (H >= Ref(L, -7)) OR ( Ref(H, -1) >= Ref(L, -7));

Buy9Intr = Buy9Req AND (Con1 OR Con2 OR Con3 OR Con4 OR Con5);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// *** Setup Sell Signal ***
//nine consecutive days closes greater than the Close four days earlier.
Con = C > Ref( C, -4);
Sell9Bars = BarsSince(BarsSince(Con));
Sell9Signal = Sell9Bars == 9;

// *** Requirements ***
//The first day of the nine-day must be preceded by a Close day immediately before it that is less than the Close four days earlier
Con = Ref(C, -9) < Ref(C, -13);
Sell9Req = Sell9Signal AND Con;

// *** Intersection ***
//the low of either day 8 or day 9 is less than or equal to the high three, four, five, six, OR seven days earlier
Con1 = (L <= Ref(H, -3)) OR ( Ref(L, -1) <= Ref(H, -3));
Con2 = (L <= Ref(H, -4)) OR ( Ref(L, -1) <= Ref(H, -4));
Con3 = (L <= Ref(H, -5)) OR ( Ref(L, -1) <= Ref(H, -5));
Con4 = (L <= Ref(H, -6)) OR ( Ref(L, -1) <= Ref(H, -6));
Con5 = (L <= Ref(H, -7)) OR ( Ref(L, -1) <= Ref(H, -7));

Sell9Intr = Sell9Req AND (Con1 OR Con2 OR Con3 OR Con4 OR Con5);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(StrToNum(NumToStr(Buy9Intr))) Sell9Intr = False;
if(StrToNum(NumToStr(Sell9Intr))) Buy9Intr = False;
BuySignal = Flip(Buy9Intr, Sell9Intr);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// *** Buy Countdown ***
//With respect to a pending Buy Signal, the close must be less than the low two days earlier;
Con = C < Ref(L, -2);
Buy13Count = Sum(Con AND BuySignal, BarsSince(Buy9Intr));
Buy13Signal = Buy13Count == 13;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// *** Sell Countdown ***
//with respect to a pending Sell Signal, the Close must be greater than the High two trading days earlier.
Con = C > Ref(H, -2);
Sell13Count = Sum(Con AND NOT BuySignal, BarsSince(Sell9Intr));
Sell13Signal = Sell13Count == 13;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//*********************************************** TD Sequential Plotting area *************************************************/
Plot(C, "", IIf(O>=C, colorRed, colorGreen), styleBar);
PlotShapes(IIf(Buy9Intr OR Sell9Intr, shapeDigit9, shapeNone),colorBlue, 0, H,20);
if(ShowNumbers)
PlotShapes(IIf(Buy9Bars==1, shapeDigit1,
IIf(Buy9Bars==2, shapeDigit2,
IIf(Buy9Bars==3, shapeDigit3,
IIf(Buy9Bars==4, shapeDigit4,
IIf(Buy9Bars==5, shapeDigit5,
IIf(Buy9Bars==6, shapeDigit6,
IIf(Buy9Bars==7, shapeDigit7,
IIf(Buy9Bars==8, shapeDigit8,
IIf(Buy9Bars >9, shapeStar,shapeNone))))))))),colorGreen, 0, H, H*.001);
if(ShowNumbers)
PlotShapes(
IIf(Sell9Bars==1, shapeDigit1,
IIf(Sell9Bars==2, shapeDigit2,
IIf(Sell9Bars==3, shapeDigit3,
IIf(Sell9Bars==4, shapeDigit4,
IIf(Sell9Bars==5, shapeDigit5,
IIf(Sell9Bars==6, shapeDigit6,
IIf(Sell9Bars==7, shapeDigit7,
IIf(Sell9Bars==8, shapeDigit8,
IIf(sell9bars>9, shapeStar,shapeNone))))))))),colorRed, 0, H, H*.001);

Sell = Sell13Signal AND NOT BuySignal;
Buy = Buy13Signal AND BuySignal;
Sell = ExRem(Sell, Buy);
Buy = ExRem(Buy, Sell);
PlotShapes(Sell*shapeDownArrow, colorYellow, 0, H, -H*.001);
PlotShapes(Buy*shapeUpArrow, colorBrightGreen, 0, L, -L*.001);

if(StrToNum(NumToStr(BuySignal)))
bgColor = ColorRGB(0,66, 2);
else
bgColor = ColorRGB(66,2, 0);
SetChartBkGradientFill( colorBlack, bgColor);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//*********************************************** TD Points Plotting area*************************************************/
if(ShowTDPoints)
{
PlotShapes(TD_Supply()*shapeSmallCircle, colorRed, 0, H, H*.001);
PlotShapes(TD_Demand()*shapeSmallCircle, colorGreen, 0, L, -L*.001);
///////////////////////////////////////////////////////////////////////////
y0 = StrToNum(NumToStr(ValueWhen(TD_Demand(), L)));
x = LineArray(0, y0, (BarCount-1), y0);
Plot(x, "", colorGold, styleDashed);
y0 = StrToNum(NumToStr(ValueWhen(TD_Supply(), H)));
x = LineArray(0, y0, (BarCount-1), y0);
Plot(x, "", colorGold, styleDashed);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//*********************************************** TDST Plotting area*************************************************/
// ---------------->>>> Code from Dave <<<----------------------
//
if(ShowTDST)
{
tdstba =Cum(0);
tdstb = Null;
HHV9 = HHV(H,9);
for (i = 0; i < 10; i++) tdstba = Null;

for( i = 10; i < BarCount; i++ )
{
if (Buy9Bars == 9)
{
HHV_b = HHV9;
if (HHV_b > C[i-9])
tdstb = HHV_b;
else tdstb = C[i-9];

for (j = 0; j < 9; j++ )
tdstba[i-j] = tdstb;
}
else tdstba = tdstb;
}

tdstsa =Cum(0);
tdsts = Null;
LLV9 = LLV(L,9);
for (i = 0; i < 10; i++) tdstsa = Null;

for( i = 10; i < BarCount; i++ )
{
if (Sell9Bars == 9)
{
LLV_b = LLV9;
if (LLV_b < C[i-9])
tdsts = LLV_b;
else tdsts = C[i-9];

for (j = 0; j < 9; j++ )
tdstsa[i-j] = tdsts;
}
else tdstsa = tdsts;
}
Plot(tdstba, "TDSTb", colorBlue,styleStaircase | styleThick|styleDots);
Plot(tdstsa, "TDSTs", colorRed,styleStaircase | styleThick|styleDots);

}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Title = "{{DATE}} - "+Name()+" ("+ FullName()+ ") - "+" Open="+O+",
High="+H+", Low="+L+", Close="+C+StrFormat(" (%.2f %.1f%%)
",IIf(ROC(C,1)==0,0,C-Ref(C,-1)),SelectedValue( ROC( C, 1 )))+
"\n"+EncodeColor(colorBlue) +"TDST Buy = " +WriteVal(tdstba, 5.2) +"
"+EncodeColor(colorRed) +"TDST Sell = " +WriteVal(tdstsa, 5.2)+
"\n"+EncodeColor(colorGold)+WriteIf(BuySignal, "(Buy Signal
Active:"+Buy13Count, "(Sell Signal Active: "+Sell13Count)+")";

_SECTION_END();
 

rkkarnani

Well-Known Member
#28
Thomas Demark Sequential2!!

Title= " Td seq I";
/*TD seq long et short side full version
http://www.amibroker.com/library/detail.php?id=396
*/

/********Optimize***********/
Opt1=Param("Opt1",9,5,21,1);
Opt2=Param("Opt2",13,1,21,1);

/*********Setup Buy*********/
TD1=IIf(Close<Ref(Close,-4),1,0);
TD2=IIf(BarsSince(BarsSince(TD1))==Opt1, 1,0); //Sum(TD1,9)==9;
TD3= Ref(H,-1)>=Ref(LLV(L,Opt1-4),-3);
TD4= Ref(C,-Opt1)>=Ref(C,-Opt2);
SetupBuy= TD3 AND TD2 AND TD4;

/***********SetupSell************/
TD1=IIf(Close>Ref(Close,-4),1,0);
TD2=IIf(BarsSince(BarsSince(TD1))==Opt1, 1,0);
TD3= Ref(L,-1)<=Ref(HHV(H,Opt1-4),-3);
TD4= Ref(C,-Opt1)<=Ref(C,-Opt2);
SetupSell= TD3 AND TD2 AND TD4 ;

/*********Count Buy ********/
CountBuy= Sum(IIf(C<Ref(C,-2),1,0),BarsSince(SetupBuy));
//or C<Ref(H,-2)

/*********Count Sell ********/
CountSell= Sum(IIf(C>Ref(C,-2),1,0),BarsSince(SetupSell));
//or C>Ref(L,-2)

/***********A***********/
B1= CountBuy >=Opt2;
B1= Hold(B1==0,2) AND B1;
Timing=(BarsSince(SetUpbuy)< BarsSince(SetUpsell));
Ccount=IIf(CountBuy >=Opt2,ValueWhen(B1,HHV(C,BarsSince(SetupBuy))),Null);
Hsetup=IIf(CountBuy >=Opt2,ValueWhen(SetupBuy,HHV(H,Opt1)),Null);
BuyA=B1 AND Timing AND Hsetup > Ccount;

/******B**********/
B2= CountBuy >Opt2 AND Close > Ref(Close,-4);
B2=Hold(B2==0,2) AND B2;
B2=ExRem(B2,B1);
BuyB=B2 AND Timing AND Hsetup > Ccount;

/*************C***********/
B3= CountBuy >Opt2 AND Close > Ref(High,-2);
B3= Hold(B3==0,2) AND B3;
B3=ExRem(B3,B1);
BuyC= B3 AND Timing AND Hsetup > Ccount;

/************Buy Signal********/
Buy=BuyB OR BuyC ;

////////////////////////////////
//SHORT
/////////////////////////////////

/***********A***********/
S1= CountSell >=Opt2;
S1= Hold(S1==0,2) AND S1;
Timing=(BarsSince(SetUpSell)< BarsSince(SetUpbuy));
Ccount=IIf(CountSell >=Opt2,ValueWhen(S1,LLV(C,BarsSince(SetupSell))),Null);
Lsetup=IIf(CountSell >=Opt2,ValueWhen(SetupSell,LLV(L,Opt1)),Null);
SellA=S1 AND Timing AND Lsetup < Ccount;

/******B**********/
S2= CountSell >Opt2 AND Close < Ref(Close,-4);
S2=Hold(S2==0,2) AND S2;
S2=ExRem(S2,S1);
SellB=S2 AND Timing AND Lsetup < Ccount;

/*************C***********/
S3= CountSell >Opt2 AND Close < Ref(Low,-2);
S3= Hold(S3==0,2) AND S3;
S3=ExRem(S3,S1);
SellC= S3 AND Timing AND Lsetup < Ccount;

/***********Short Signal********/
Short= SellB OR SellC ;

Plot(C,"",IIf(Short,colorYellow,IIf(Buy,colorGreen,1)),64);

PlotShapes(IIf(Short,
shapeDownArrow,shapeNone),colorYellow,0,H,-10);
PlotShapes(IIf(Buy,
shapeUpArrow,shapeNone),colorGreen,0,L,-10);

PlotShapes(IIf(SetupSell,
shapeDigit9,shapeNone),colorRed,0,H,20);
PlotShapes(IIf(SetupBuy,
shapeDigit9,shapeNone),colorBlue,0,L,-20);
 

rkkarnani

Well-Known Member
#29
NMA Swing trade AFL by Karthik

Nick's MA Swing Trading AFL by Karthik :

SetChartOptions(0,chartShowArrows|chartShowDates);
strWeekday = StrMid("SunMonTueWedThuFriSat", SelectedValue(DayOfWeek())*3,3);

_SECTION_BEGIN("price");
UpCandle = ParamColor("Up Color", colorBrightGreen );
DownCandle = ParamColor("Down Color", colorDarkRed );
Consolidation = ParamColor("Consolidation", colorBlack );
BG2a=HHV(LLV(L,4)+ATR(4),8);
BR2a=LLV(HHV(H,4)-ATR(4),8);
Candlecolor = IIf(Close>BG2a ,UpCandle,IIf(Close < BR2a,DownCandle,Consolidation));
SetBarFillColor( IIf(O <C, colorSeaGreen,colorOrange) );
Plot( Close, "Price", CandleColor, styleCandle );
_SECTION_END();

_SECTION_BEGIN("NMA ");
//MY STOCKS
mult = 0; Period= 0; Com=0;
if (Name() == "BANKNIFTY_F1") {Com= in5Minute*2; mult = 1.75; period = 42;} //
if (Name() == "MINIFTY_F1") {Com= in5Minute*3; mult = 1.25; period = 14;} //
if (Name() == "NIFTY_DEC") {Com= in5Minute*6; mult = 1.50; period = 49;} //

if (Name() == "DLF.NS") {Com= in5Minute*4; mult = 1; period = 25;}
if (Name() == "GAIL.NS") {Com= in5Minute*4; mult = 1.50; period = 10;}
//if (Name() == "GTLINFRA.NS") { mult = 1.75; period = 36;}

//-------------------------------------------------------------------------------------------
if(Interval() != COM )
{T5 = " ALERT!!!" + " " + Name() + "\n" + " " + "Set the chart
Time Frame to: " + NumToStr(com/60, 1.0, 1) + " Mints";}
else if(Interval() == COM )
{T5="Good Luck "; }
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 ) );
ms=ParamList("ST0P/REV",List="Reg|Smoothed",0);
if(ms=="Reg")
{nm =(H-L);
j=(O+H+L+C)/4;
}
else
{nm=(HaHigh-HaLow);
j=(HaOpen+HaHigh+HaLow+HaClose)/4;
}
rfsctor = WMA(nm,period);
revers = mult * 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];
}
}
}
}
//Plot(NW, "", IIf(Trend == 1, 6, 4), 4);
if(ms=="Reg")
{
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
Buysetup=Flip(Buy,Sell);
Shortsetup=Flip(Sell,Buy);
BPrice=ValueWhen(Buy,C,1);
Sprice=ValueWhen(Sell,C,1);
COM2=("------Regular System-------"+"\n"+
WriteIf (Buy , "GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , "EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+
WriteIf(Sell , "Total Profit/Loss for the Last Trade ."+(C-BPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade ."+(SPrice-C)+"","")+
WriteIf(Buysetup AND NOT Buy, "Trade : Long - Entry price Rs."+(BPrice)," ")+
WriteIf(Shortsetup AND NOT Sell, " Trade : Short - Entry price Rs."+(SPrice)," ")+"\n"+
WriteIf(Buysetup , "Current Profit/Loss Rs. "+(C-BPrice)+"","")+
WriteIf(Shortsetup , "Current Profit/Loss Rs. "+(SPrice-C)+"",""));
pl1=SellPrice-BuyPrice;
Filter=Buy OR Sell ;
AddColumn(IIf(Buy,BPrice,Null),"Buy/Cover", 1.2,1,colorGreen,70);
AddColumn(IIf(Sell,SPrice,Null),"Sell/Short " ,1.2,1,colorOrange,70);
AddColumn(IIf(Sell,pl1,Null),"Profit/Loss ",1.2,1,colorGold,70);
}
else
{
B = Cross(j,nw);
S = Cross(nw,j);
Buysetup=Flip(b,s);
Shortsetup=Flip(s,b);
BuySetupValue = ValueWhen(b,H,1);
ShortsetupValue = ValueWhen(s,L,1);
b1= Buysetup AND Cross(C,BuySetupValue);
s1= Shortsetup AND Cross(ShortsetupValue,C);
Buy=b1;
Short=s1;
Sell=Shortsetup;
Cover=Buysetup;
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
Long=Flip(Buy,Sell OR Cover);
Shrt=Flip(Short,Cover OR Sell);
NOTrade= NOT (Long OR shrt);
BuyPrice=ValueWhen(Buy,C,1);
ShortPrice=ValueWhen(Short,C,1);
SellPrice=ValueWhen(Sell,C,1);
CoverPrice=ValueWhen(Cover,C,1);
pl1=SellPrice-BuyPrice;
pl2=ShortPrice-CoverPrice;
Com2=("------Smoothed System-------"+"\n"+
WriteIf (Buy , " GO LONG at "+BuyPrice+" ","")+
WriteIf (Sell , " EXIT LONG at "+SellPrice+" ","")+
WriteIf (Short , " GO SHORT at "+ShortPrice+" ","")+
WriteIf (Cover , " COVER SHORT at "+CoverPrice+" ","")+"\n"+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(pl1)+"","")+
WriteIf(Cover , "Total Profit/Loss for the Last trade Rs."+(pl2)+"","")+"\n"+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice)," ")+
WriteIf(shrt AND NOT Cover, " Trade : Short - Entry price Rs."+(ShortPrice)," ")+"\n"+
WriteIf(Long AND NOT Sell, " Current P / L Rs."+(C-BuyPrice)+""," ")+
WriteIf(shrt AND NOT Cover, " Current P / L Rs."+(ShortPrice-C)+""," ")+
WriteIf(NOT Long AND NOT shrt AND NOT Sell AND NOT Cover, "NO TRADE DONE - WAITING",""));

}
dist = 1.5*ATR(4);
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist, colorLime );
if( Sell ) PlotText( "Sell\n" + C[ i ], i, H[ i ]+dist, colorOrange);
if( Short ) PlotText( "Short\n" + C[ i ], i, L[ i ]+dist, colorRed );
if( Cover ) PlotText( "cover\n" + C[ i ], i, H[ i ]-dist, colorGreen);
}
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorSkyblue, 0,Low,-15);
PlotShapes(IIf(Sell, shapeHollowDownArrow, shapeNone),colorLightYellow, 0,High,-15);
PlotShapes(IIf(Cover, shapeHollowUpArrow, shapeNone),colorTan, 0,Low,-25);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorGold, 0,High,-25);
Buysetup=Flip(Buy,Sell);
Shortsetup=Flip(Sell,Buy);
Plot(IIf(Buysetup,nw,Null),"",colorBlue,512|1024);
Plot(IIf(Shortsetup,nw,Null), "",colorDarkRed,512|1024);

be = BarIndex() < LastValue(BarIndex());
AlertIf( be AND Buy, "", "Buy ", 1 );
AlertIf( be AND Buy, "SOUND C:\\Windows\\Media\\notify.wav", "Audio alert", 1 );
AlertIf( be AND Sell, "", "Sell", 2 );
AlertIf( be AND Sell, "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 2 );
AlertIf( be AND Short, "", "Short", 3 );
AlertIf( be AND Short, "SOUND C:\\Windows\\Media\\chord.wav", "Audio alert", 3 );
AlertIf( be AND Cover, "", "Cover", 4 );
AlertIf( be AND Cover, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 4 );
_SECTION_END();
//-----------end--------------


function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}

RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;
Secsleft = SecsToGo % 60 ;
Minleft = int( SecsToGo / 60 );
Time = "\\c09 " + Minleft + "\\c02 :" + "\\c07 " + Secsleft ;

if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "NMA 3.6 a ("+mult+" - "+perIOD+" - "+ms+")" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" # "+strWeekday +" , "+ Date()+ EncodeColor(colorAqua) +" Time left " +TIME+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n" + EncodeColor(colorWhite)+Com2 );
_SECTION_END();

grid_day = IIf(Day()!=Ref(Day(),-1),1,0);
Plot(grid_day,"",colorDarkGrey,styleHistogram|styleDashed|styleNoLabel|styleOwnScale);

_SECTION_BEGIN("Background text");
bkclr=ParamColor("Bk-col",colorDarkGrey);
SetChartBkColor(ColorBlend(bkclr, colorTan, 0.2));
gxs=Param("GRAPH spaceing",10,5,50,5);
GraphXSpace = gxs;
z = (GetPerformanceCounter()/100)%256;
anim=ColorHSB( ( z ) % 250, 256, Param("Gfx Brightness", 5, 0, 255, 1 ));
RequestTimedRefresh(2);

Font= ParamList("Font:","Arial|Calibri|Futura|Tahoma|MS Sans Serif|Times New Roman ",4);
GfxSetTextAlign( 6 );
GfxSelectFont(Font, 10, 700, False, False, 0);
GfxSetTextColor(z);
GfxTextOut(""+T5+"", Status("pxwidth")/2 , Status("pxheight")-40 );

GfxSetBkMode( 0 );GfxSetOverlayMode(1); GfxSetTextColor(1);
GfxSelectFont(Font, 12, 700, False, False, 0);
GfxTextOut("NMA v 3.6 T.sys ", Status("pxwidth")/2 , Status("pxheight")/3 );

_SECTION_END();
 

rkkarnani

Well-Known Member
#30
NMA Swing trade AFL by Karthik (Different version)

NMA Swing trade AFL by Karthik (Different version)

_SECTION_BEGIN("NICK MA Swing");
SetBarsRequired(200,0);
GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Param("K", 1.5, 1, 5, 0.1);
Per = Param("ATR", 3, 1, 30, 0.50);
k1 = Optimize("K", 1, 0.1, 5, 0.1);
Per1 = Optimize("ATR", 3, 1, 30, 0.50);
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 ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorBlack, styleCandle | styleNoLabel );
j=Haclose;
//=======================================================================================================================
//=========================Indicator==============================================================================================
f=ATR(14);

rfsctor = WMA(H-L, Per);

revers = k * 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];
}
}
}
}

//===============system================

Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-f, High+f));
_SECTION_END();

//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "NMA Swing System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - " +EncodeColor(colorWhite)+
WriteIf (Buy, " GO LONG / Reverse Signal at "+C+" "," ")+EncodeColor(colorYellow)+
WriteIf (Sell, " EXIT LONG / Reverse Signal at "+C+" "," ")+EncodeColor(colorRed));
_SECTION_END();
 

Similar threads