Nifty Daily NMA Charts
Parameter used : k=2,ATR=20
Problem Facing : Entry is good and Exit is poor so far in case of Daily NMA Charts
Signals and Results of Long only trades with Daily NMA after post election rally
Symbol | Trade | Date | Price | Ex. date | Ex. Price | Profit | % Profit | Shares | Position value | Cum. Profit |
---|---|---|---|---|---|---|---|---|---|---|
NIFTY | Long | 6/29/2009 | 4390.95 | 7/7/2009 | 4202.15 | -429.98 | -4.30% | 2.27741 | 10000 | -429.98 |
NIFTY | Long | 7/15/2009 | 4233.5 | 8/7/2009 | 4481.4 | 560.39 | 5.86% | 2.26055 | 9570.02 | 130.41 |
NIFTY | Long | 8/14/2009 | 4580.05 | 8/17/2009 | 4387.9 | -425.01 | -4.20% | 2.21186 | 10130.41 | -294.59 |
NIFTY | Long | 8/24/2009 | 4642.8 | 9/2/2009 | 4608.35 | -72.02 | -0.74% | 2.09042 | 9705.41 | -366.61 |
NIFTY | Long | 9/7/2009 | 4782.9 | 10/6/2009 | 5027.4 | 492.46 | 5.11% | 2.01413 | 9633.39 | 125.85 |
NIFTY | Long | 10/14/2009 | 5118.2 | 10/21/2009 | 5063.6 | -108.02 | -1.07% | 1.9784 | 10125.85 | 17.83 |
NIFTY | Long | 11/6/2009 | 4796.15 | 11/27/2009 | 4941.75 | 304.12 | 3.04% | 2.08872 | 10017.83 | 321.94 |
NIFTY | Long | 12/2/2009 | 5123.25 | 12/16/2009 | 5042.05 | -163.6 | -1.58% | 2.01473 | 10321.94 | 158.35 |
NIFTY | Long | 12/23/2009 | 5144.6 | 1/13/2010 | 5233.95 | 176.43 | 1.74% | 1.97457 | 10158.35 | 334.78 |
NIFTY | Open Long | 2/16/2010 | 4855.75 | 3/31/2010 | 5249.1 | 837.19 | 8.10% | 2.12836 | 10334.77 | 1171.96 |
Statistics | |||
---|---|---|---|
All trades | Long trades | Short trades | |
Initial capital | 10000 | 10000 | 10000 |
Ending capital | 11171.96 | 11171.96 | 10000 |
Net Profit | 1171.96 | 1171.96 | 0 |
Net Profit % | 11.72% | 11.72% | 0.00% |
Exposure % | 51.82% | 51.82% | 0.00% |
Net Risk Adjusted Return % | 22.62% | 22.62% | N/A |
Annual Return % | 13.00% | 13.00% | 0.00% |
Risk Adjusted Return % | 25.09% | 25.09% | N/A |
All trades | 10 | 10 (100.00 %) | 0 (0.00 %) |
Avg. Profit/Loss | 117.2 | 117.2 | N/A |
Avg. Profit/Loss % | 1.20% | 1.20% | N/A |
Avg. Bars Held | 12.4 | 12.4 | N/A |
Winners | 5 (50.00 %) | 5 (50.00 %) | 0 (0.00 %) |
Total Profit | 2370.58 | 2370.58 | 0 |
Avg. Profit | 474.12 | 474.12 | N/A |
Avg. Profit % | 4.77% | 4.77% | N/A |
Avg. Bars Held | 18 | 18 | N/A |
Max. Consecutive | 2 | 2 | 0 |
Largest win | 837.19 | 837.19 | 0 |
No of bars in largest win | 29 | 29 | 0 |
Losers | 5 (50.00 %) | 5 (50.00 %) | 0 (0.00 %) |
Total Loss | -1198.61 | -1198.61 | 0 |
Avg. Loss | -239.72 | -239.72 | N/A |
Avg. Loss % | -2.38% | -2.38% | N/A |
Avg. Bars Held | 6.8 | 6.8 | N/A |
Max. Consecutive | 2 | 2 | 0 |
Largest loss | -429.98 | -429.98 | 0 |
# bars in largest loss | 7 | 7 | 0 |
Max. trade drawdown | -588.82 | -588.82 | 0 |
Max. trade % drawdown | -5.84% | -5.84% | 0.00% |
Max. system drawdown | -977.95 | -977.95 | 0 |
Max. system % drawdown | -9.22% | -9.22% | 0.00% |
Recovery Factor | 1.2 | 1.2 | N/A |
CAR/MaxDD | 1.41 | 1.41 | N/A |
RAR/MaxDD | 2.72 | 2.72 | N/A |
Profit Factor | 1.98 | 1.98 | N/A |
Payoff Ratio | 1.98 | 1.98 | N/A |
Standard Error | 254.47 | 254.47 | 0 |
Risk-Reward Ratio | 3.82 | 3.82 | N/A |
Ulcer Index | 4.01 | 4.01 | 0 |
Ulcer Performance Index | 1.89 | 1.89 | N/A |
Sharpe Ratio of trades | 1.05 | 1.05 | 0 |
K-Ratio | 0.0674 | 0.0674 | -1.#IND |
NMA Weekly Charts
NMA Weekly Charts indicating long term buy signal in weekly charts since last week.
Respected Sir,
Pls also check if v use k=5 & atr=20 in Hourly chart. In this we will have minimum of 80 points in every trade.
Regards,
Dipak
Hi rajanderan try the undermentioned formulae on EOD charts
For NIFTY 01 year it gives NET 65.23 % profit ( 31 MAR 2009 to Mar 2010 )
For BANKNIFTY 01 year it gives NET 79 % profit ( 31 MAR 2009 to Mar 2010 )
Really amazing !
following is the code
_SECTION_BEGIN(“Price”);
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”, colorBlack ), styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN(“MA”);
P = ParamField(“Price field”,-1);
Periods = Param(“Periods”, 8, 2, 200, 1 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN(“Mid MA”);
P = ParamField(“Price field”,-1);
Periods = Param(“Periods”, 34, 2, 300, 1 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN(“Long MA”);
P = ParamField(“Price field”,-1);
Periods = Param(“Periods”, 200, 2, 400, 1 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) | styleNoRescale );
_SECTION_END();
_SECTION_END();
_SECTION_BEGIN(“SAR”);
acc = Param(“Acceleration”, 0.02, 0, 1, 0.001 );
accm = Param(“Max. acceleration”, 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”, styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
RSIperiod = 15; // Param(“RSI p”,3,14,30,1);
Percent = 5; // Param(“ZIG %”,8,9,15,1);
EMAperiod = 5; //Param(“EMA p”,4,5,10,1);
HHVperiod = 8; //Param(“HHV p”,3,5,10,1);
NumLine = 2; //Param(“Num Lines”,3,1,20,1);
Base = DEMA(RSI(RSIperiod),EMAperiod);
for( i = 1; i <= numline; i++ )
{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed, styleLine);
Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen, styleLine);
}
Title = Name() + "; " + Date() + ": Support & Resistance Levels using RSI: " + /*EncodeColor(colorGreen)+ "Support Levels are Green; "+EncodeColor(colorRed)+ "Resistance Levels are Red: "+EncodeColor(colorBlack)+*/ "Num lines ="+WriteVal(numline,1) ;
_SECTION_BEGIN("heikin");
// Calculate Moving Average
MAPeriod = Param("MA Period", 15, 1, 100);
MAOpen = EMA(Open, MAPeriod);
MAHigh = EMA(High, MAPeriod);
MALow = EMA(Low, MAPeriod);
MAClose = EMA(Close, MAPeriod);
HaClose = (MAOpen + MAHigh + MALow + MAClose) / 4;
HaOpen = AMA(Ref(HaClose, -1), 0.5);
// for graph collapse
for(i = 0; i <= MAPeriod; i++) HaClose[i] = Null;
/*
// same
// HaOpen = (Ref(HaOpen, -1) + Ref(HaClose, -1)) / 2;
HaOpen[ 0 ] = HaClose[ 0 ];
for(i = 1; i < BarCount; i++) {
HaOpen[i] = (HaOpen[i – 1] + HaClose[i – 1]) / 2;
}
*/
HaHigh = Max(MAHigh, Max(HaClose, HaOpen));
HaLow = Min(MALow, Min(HaClose, HaOpen));
// outs comments
"BarIndex = " + BarIndex();
"Open = " + Open;
"High = " + High;
"Low = " + Low;
"Close = "+ Close;
"HaOpen = " + HaOpen;
"HaHigh = " + HaHigh;
"HaLow = " + HaLow;
"HaClose = "+ HaClose;
/* **********************************
Code to automatically identify pivots
********************************** */
// — what will be our lookback range for the hh and ll?
farback=Param("How Far back to go",100,50,5000,10);
nBars = Param("Number of bars", 12, 5, 40);
// — Create 0-initialized arrays the size of barcount
aHPivs = H – H;
aLPivs = L – L;
// — More for future use, not necessary for basic plotting
aHPivHighs = H – H;
aLPivLows = L – L;
aHPivIdxs = H – H;
aLPivIdxs = L – L;
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
// — looking back from the current bar, how many bars
// back were the hhv and llv values of the previous
// n bars, etc.?
aHHVBars = HHVBars(H, nBars);
aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);
aLLV = LLV(L, nBars);
// — Would like to set this up so pivots are calculated back from
// last visible bar to make it easy to "go back" and see the pivots
// this code would find. However, the first instance of
// _Trace output will show a value of 0
aVisBars = Status("barvisible");
nLastVisBar = LastValue(Highest(IIf(aVisBars, BarIndex(), 0)));
_TRACE("Last visible bar: " + nLastVisBar);
// — Initialize value of curTrend
curBar = (BarCount-1);
curTrend = "";
if (aLLVBars[curBar] <
aHHVBars[curBar]) {
curTrend = "D";
}
else {
curTrend = "U";
}
// — Loop through bars. Search for
// entirely array-based approach
// in future version
for (i=0; i<farback; i++) {
curBar = (BarCount – 1) – i;
// — Have we identified a pivot? If trend is down…
if (aLLVBars[curBar] lastHPIdx) {
// — Bar and price info for candidate pivot
candIdx = curBar – aHHVBars[curBar];
candPrc = aHHV[curBar];
if (
lastHPH lastLPIdx AND
candIdx < curBar) {
// — OK, we'll add this as a pivot…
aHPivs[candIdx] = 1;
// …and then rearrange elements in the
// pivot information arrays
for (j=0; j candPrc AND
candIdx > lastHPIdx AND
candIdx < curBar) {
// — OK, we'll add this as a pivot…
aLPivs[candIdx] = 1;
// …and then rearrange elements in the
// pivot information arrays
for (j=0; j<nLPivs; j++) {
aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
}
aLPivLows[0] = candPrc;
aLPivIdxs[0] = candIdx;
nLPivs++;
}
}
// — Dump inventory of high pivots for debugging
/*
for (k=0; k<nHPivs; k++) {
_TRACE("High pivot no. " + k
+ " at barindex: " + aHPivIdxs[k] + ", "
+ WriteVal(ValueWhen(BarIndex()==aHPivIdxs[k],
DateTime(), 1), formatDateTime)
+ ", " + aHPivHighs[k]);
}
*/
// — OK, let's plot the pivots using arrows
PlotShapes(
IIf(aHPivs==1, shapeDownArrow, shapeNone), colorRed, 0,
High, Offset=-15);
PlotShapes(
IIf(aLPivs==1, shapeUpArrow , shapeNone), colorBrightGreen, 0,
Low, Offset=-15);
AlertIf( aLPivs==1, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Audio alert", 2 );
AlertIf( aHPivs==1, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
Buy=(aLPivs==1);
Cover=(aLPivs==1);
Sell=(aHPivs==1);
Short=(aHPivs==1);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE============================ ================================================== ==================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorLightBlue)+ "Heikin-Ashi pivot + NMA Swing system – Boxed arrows NMA buy-sell – Normal Arrows Heikin Pivot Buy-Sell" + " – " + Name() + " – " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" – " + Date() +" – "+"
" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"
"+
EncodeColor(colorRed)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"
"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long – Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short – Entry price Rs."+(SellPrice),"")+"
"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
AlertIf( Buy, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
_SECTION_END();
Hi sandhu348,
Could u pls send this afl as file attachment to my e-mail id at [email protected]. It is showing some errors. Thanx in advance.
Regards,
Dipak
Dear sandhu348, I`m also getting error in my AB 5.29. It says : error 31. Syntex error, expecting ‘)’ or ‘,’. Please post a solution or the afl.
Piash
Hi sandhu348,
Could u pls send this afl as file attachment to my e-mail id at [email protected]. It is showing some errors in the pivot section . Thanx in advance.
Hi Mr. Sandhu348,
Want to try ur AFL but contains lot of errors. Can u please rectify and repost..
Thanks
Shree
_SECTION_BEGIN(“MA”);
P = ParamField(“Price field”,-1);
Periods = Param(“Periods”, 8, 2, 200, 1 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN(“Mid MA”);
P = ParamField(“Price field”,-1);
Periods = Param(“Periods”, 34, 2, 300, 1 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) | styleNoRescale );
_SECTION_END();
_SECTION_BEGIN(“Long MA”);
P = ParamField(“Price field”,-1);
Periods = Param(“Periods”, 200, 2, 400, 1 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”) | styleNoRescale );
_SECTION_END();
_SECTION_END();
_SECTION_BEGIN(“SAR”);
acc = Param(“Acceleration”, 0.02, 0, 1, 0.001 );
accm = Param(“Max. acceleration”, 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( “Color”, colorCycle ), ParamStyle(“Style”, styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
RSIperiod = 15; // Param(“RSI p”,3,14,30,1);
Percent = 5; // Param(“ZIG %”,8,9,15,1);
EMAperiod = 5; //Param(“EMA p”,4,5,10,1);
HHVperiod = 8; //Param(“HHV p”,3,5,10,1);
NumLine = 2; //Param(“Num Lines”,3,1,20,1);
Base = DEMA(RSI(RSIperiod),EMAperiod);
for( i = 1; i <= numline; i++ )
{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed, styleLine);
Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen, styleLine);
}
Title = Name() + "; " + Date() + ": Support & Resistance Levels using RSI: " + /*EncodeColor(colorGreen)+ "Support Levels are Green; "+EncodeColor(colorRed)+ "Resistance Levels are Red: "+EncodeColor(colorBlack)+*/ "Num lines ="+WriteVal(numline,1) ;
_SECTION_BEGIN("heikin");
// Calculate Moving Average
MAPeriod = Param("MA Period", 15, 1, 100);
MAOpen = EMA(Open, MAPeriod);
MAHigh = EMA(High, MAPeriod);
MALow = EMA(Low, MAPeriod);
MAClose = EMA(Close, MAPeriod);
HaClose = (MAOpen + MAHigh + MALow + MAClose) / 4;
HaOpen = AMA(Ref(HaClose, -1), 0.5);
// for graph collapse
for(i = 0; i <= MAPeriod; i++) HaClose[i] = Null;
/*
// same
// HaOpen = (Ref(HaOpen, -1) + Ref(HaClose, -1)) / 2;
HaOpen[ 0 ] = HaClose[ 0 ];
for(i = 1; i < BarCount; i++) {
HaOpen[i] = (HaOpen[i – 1] + HaClose[i – 1]) / 2;
}
*/
HaHigh = Max(MAHigh, Max(HaClose, HaOpen));
HaLow = Min(MALow, Min(HaClose, HaOpen));
// outs comments
"BarIndex = " + BarIndex();
"Open = " + Open;
"High = " + High;
"Low = " + Low;
"Close = "+ Close;
"HaOpen = " + HaOpen;
"HaHigh = " + HaHigh;
"HaLow = " + HaLow;
"HaClose = "+ HaClose;
/* **********************************
Code to automatically identify pivots
********************************** */
// — what will be our lookback range for the hh and ll?
farback=Param("How Far back to go",100,50,5000,10);
nBars = Param("Number of bars", 12, 5, 40);
// — Create 0-initialized arrays the size of barcount
aHPivs = H – H;
aLPivs = L – L;
// — More for future use, not necessary for basic plotting
aHPivHighs = H – H;
aLPivLows = L – L;
aHPivIdxs = H – H;
aLPivIdxs = L – L;
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
// — looking back from the current bar, how many bars
// back were the hhv and llv values of the previous
// n bars, etc.?
aHHVBars = HHVBars(H, nBars);
aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);
aLLV = LLV(L, nBars);
// — Would like to set this up so pivots are calculated back from
// last visible bar to make it easy to "go back" and see the pivots
// this code would find. However, the first instance of
// _Trace output will show a value of 0
aVisBars = Status("barvisible");
nLastVisBar = LastValue(Highest(IIf(aVisBars, BarIndex(), 0)));
_TRACE("Last visible bar: " + nLastVisBar);
// — Initialize value of curTrend
curBar = (BarCount-1);
curTrend = "";
if (aLLVBars[curBar] <
aHHVBars[curBar]) {
curTrend = "D";
}
else {
curTrend = "U";
}
// — Loop through bars. Search for
// entirely array-based approach
// in future version
for (i=0; i<farback; i++) {
curBar = (BarCount – 1) – i;
// — Have we identified a pivot? If trend is down…
if (aLLVBars[curBar] lastHPIdx) {
// — Bar and price info for candidate pivot
candIdx = curBar – aHHVBars[curBar];
candPrc = aHHV[curBar];
if (
lastHPH lastLPIdx AND
candIdx < curBar) {
// — OK, we'll add this as a pivot…
aHPivs[candIdx] = 1;
// …and then rearrange elements in the
// pivot information arrays
for (j=0; j candPrc AND
candIdx > lastHPIdx AND
candIdx < curBar) {
// — OK, we'll add this as a pivot…
aLPivs[candIdx] = 1;
// …and then rearrange elements in the
// pivot information arrays
for (j=0; j<nLPivs; j++) {
aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
}
aLPivLows[0] = candPrc;
aLPivIdxs[0] = candIdx;
nLPivs++;
}
}
// — Dump inventory of high pivots for debugging
/*
for (k=0; k<nHPivs; k++) {
_TRACE("High pivot no. " + k
+ " at barindex: " + aHPivIdxs[k] + ", "
+ WriteVal(ValueWhen(BarIndex()==aHPivIdxs[k],
DateTime(), 1), formatDateTime)
+ ", " + aHPivHighs[k]);
}
*/
// — OK, let's plot the pivots using arrows
PlotShapes(
IIf(aHPivs==1, shapeDownArrow, shapeNone), colorRed, 0,
High, Offset=-15);
PlotShapes(
IIf(aLPivs==1, shapeUpArrow , shapeNone), colorBrightGreen, 0,
Low, Offset=-15);
AlertIf( aLPivs==1, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Audio alert", 2 );
AlertIf( aHPivs==1, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
Buy=(aLPivs==1);
Cover=(aLPivs==1);
Sell=(aHPivs==1);
Short=(aHPivs==1);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE============================ ================================================== ==================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorLightBlue)+ "Heikin-Ashi pivot + NMA Swing system – Boxed arrows NMA buy-sell – Normal Arrows Heikin Pivot Buy-Sell" + " – " + Name() + " – " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" – " + Date() +" – "+"
" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"
"+
EncodeColor(colorRed)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"
"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long – Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short – Entry price Rs."+(SellPrice),"")+"
"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
AlertIf( Buy, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
_SECTION_END();
still the error begins from this line upper side is ok no problem till this lines
pls rectify the same thanks
// — Have we identified a pivot? If trend is down…
if (aLLVBars[curBar] lastHPIdx) {
// — Bar and price info for candidate pivot
candIdx = curBar – aHHVBars[curBar];
candPrc = aHHV[curBar];
if (
lastHPH >lastLPIdx AND
candIdx lastHPIdx AND
candIdx < curBar) {
// — OK, we'll add this as a pivot…
aLPivs[candIdx] = 1;
// …and then rearrange elements in the
// pivot information arrays
for (j=0; j<nLPivs; j++) {
aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
}
aLPivLows[0] = candPrc;
aLPivIdxs[0] = candIdx;
nLPivs++;
}
}
// — Dump inventory of high pivots for debugging
/*
for (k=0; k<nHPivs; k++) {
_TRACE("High pivot no. " + k
+ " at barindex: " + aHPivIdxs[k] + ", "
+ WriteVal(ValueWhen(BarIndex()==aHPivIdxs[k],
DateTime(), 1), formatDateTime)
+ ", " + aHPivHighs[k]);
}
*/
// — OK, let's plot the pivots using arrows
PlotShapes(
IIf(aHPivs==1, shapeDownArrow, shapeNone), colorRed, 0,
High, Offset=-15);
PlotShapes(
IIf(aLPivs==1, shapeUpArrow , shapeNone), colorBrightGreen, 0,
Low, Offset=-15);
AlertIf( aLPivs==1, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Audio alert", 2 );
AlertIf( aHPivs==1, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
Buy=(aLPivs==1);
Cover=(aLPivs==1);
Sell=(aHPivs==1);
Short=(aHPivs==1);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE============================ ================================================== ==================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorLightBlue)+ "Heikin-Ashi pivot + NMA Swing system – Boxed arrows NMA buy-sell – Normal Arrows Heikin Pivot Buy-Sell" + " – " + Name() + " – " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" – " + Date() +" – "+"
" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"
"+
EncodeColor(colorRed)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"
"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long – Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short – Entry price Rs."+(SellPrice),"")+"
"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
AlertIf( Buy, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 );
_SECTION_END();
Hi , i don’t know why after pasting / coping into this page it miss some data. kindly contact me at [email protected] i will attach the AFL as attachment
thanks !
Dear Rajandran sir
I am using NMA signals. It is working fine and getting maximum points in nifty , my settings are ATR=4 and K=1 . Chances of whipsaws r more but that is OK for me .
Yeah amol 1,4 can be used for short term bias. I am using 2,20 to guage the overal trend. As the whipsaws are minimum and 2,20 supports medium term bias
Amol Vaidya sir i tried but not working my side. Sir kindly send the afl file in my email id : [email protected]
Thank U
Raj
Rajandran NMA AFL codes seems to be bugged. Can you please send mail ([email protected]) or update the code afresh in your website?
plz send thios afl plzzzzzzzzzzzzz i give 5 star to this afl plz send on my mail ……thanks