Re: nwa swing trading by karthik
Casoni Hi
This is nice chart , but i am not getting this version of NMA 3.6b at given link . Please post AFL so that every one following this thread here can be benefited . Thanx :clapping:
It is there on the site
NOTHING VERY SPECIAL
___________________________________________________
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_F1") {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();