I had added few more codes to the NMA Buy or Sell Signal to make it exploration possible. The purpose of the Exploration is to
identify the stop loss of any kind of trade at the given time.
Note : The Candles of NMA are different from the normal candles as HaOpen, HaLow,HaHigh,HaClose are involved rather than traditional Open,High,Low,Close check out the formulas for Heikin-Ashi Technique here. And the system uses ATR trailing stop loss along with Heiking-Ashi Technique. In the Exploration i had added the HaClose and Close as the Stop Loss and Reverse is purely based on HaClose and not on Close alone. So if HaClose is greater than trailing ATR stop loss then it is a Buy Signal else it would be the sell signal.
Using the NMA Exploration AFL I had given the Stop Loss and Reverse for Nifty 50 Pack.
Ticker | Date/Time | SAR | HA Close | Close | MODE |
---|---|---|---|---|---|
ABB | 9/20/2010 | 820.7 | 855.85 | 864.2 | BUY MODE |
ACC | 9/20/2010 | 953.26 | 1010.25 | 1021.1 | BUY MODE |
AMBUJACEM | 9/20/2010 | 134.6 | 144.6 | 145.45 | BUY MODE |
AXISBANK | 9/20/2010 | 1435.9 | 1526.76 | 1546.85 | BUY MODE |
BHARTIARTL | 9/20/2010 | 342.56 | 364.24 | 365.95 | BUY MODE |
BHEL | 9/20/2010 | 2418.01 | 2444.56 | 2442.55 | BUY MODE |
BPCL | 9/20/2010 | 729.89 | 782.66 | 802.15 | BUY MODE |
CAIRN | 9/20/2010 | 329.1 | 342.61 | 343.75 | BUY MODE |
CIPLA | 9/20/2010 | 318.27 | 313.41 | 315.95 | SELL MODE |
DLF | 9/20/2010 | 337.34 | 358.23 | 365.65 | BUY MODE |
GAIL | 9/20/2010 | 454.35 | 482.05 | 480 | BUY MODE |
HCLTECH | 9/20/2010 | 395.37 | 420.7 | 422.1 | BUY MODE |
HDFC | 9/20/2010 | 661.8 | 697.58 | 706.3 | BUY MODE |
HDFCBANK | 9/20/2010 | 2331.95 | 2428.91 | 2446.2 | BUY MODE |
HEROHONDA | 9/20/2010 | 1809.47 | 1787.59 | 1821.25 | SELL MODE |
HINDALCO | 9/20/2010 | 178.78 | 191.28 | 193.95 | BUY MODE |
HINDUNILVR | 9/20/2010 | 276.67 | 288.42 | 293.2 | BUY MODE |
ICICIBANK | 9/20/2010 | 1071.33 | 1120.38 | 1127.75 | BUY MODE |
IDEA | 9/20/2010 | 72.21 | 77.24 | 76.75 | BUY MODE |
IDFC | 9/20/2010 | 186.66 | 194.05 | 195.1 | BUY MO... |
INFOSYSTCH | 9/20/2010 | 2896.48 | 2994.15 | 3008.6 | BUY MODE |
ITC | 9/20/2010 | 164.77 | 172.91 | 176.65 | BUY MODE |
JINDALSTEL | 9/20/2010 | 688.49 | 711.76 | 712.65 | BUY MODE |
JPASSOCIAT | 9/20/2010 | 118.26 | 123.69 | 124.9 | BUY MODE |
KOTAKBANK | 9/20/2010 | 450.09 | 476.13 | 474.75 | BUY MODE |
LT | 9/20/2010 | 1913.98 | 1983.3 | 2000.05 | BUY MODE |
M&M | 9/20/2010 | 653.09 | 685.42 | 687.8 | BUY MODE |
MARUTI | 9/20/2010 | 1333.05 | 1393.47 | 1398.9 | BUY MODE |
NTPC | 9/20/2010 | 198.21 | 206.13 | 205.3 | BUY MODE |
ONGC | 9/20/2010 | 1346.36 | 1407.55 | 1404.2 | BUY MODE |
PNB | 9/20/2010 | 1226.55 | 1291.93 | 1290.7 | BUY MODE |
POWERGRID | 9/20/2010 | 103.34 | 105.78 | 105.65 | BUY MODE |
RANBAXY | 9/20/2010 | 505.49 | 533.91 | 532.25 | BUY MODE |
RELIANCE | 9/20/2010 | 990.97 | 1033.86 | 1041.4 | BUY MODE |
RELINFRA | 9/20/2010 | 1023.8 | 1078.2 | 1087.55 | BUY MODE |
RPOWER | 9/20/2010 | 154.71 | 162.06 | 162.45 | BUY MODE |
SAIL | 9/20/2010 | 195.02 | 203.64 | 205.3 | BUY MODE |
SBIN | 9/20/2010 | 2976.58 | 3101.9 | 3108.9 | BUY MODE |
SIEMENS | 9/20/2010 | 728.57 | 759.06 | 763.45 | BUY MODE |
STER | 9/20/2010 | 162.56 | 172.95 | 172.15 | BUY MODE |
SUNPHARMA | 9/20/2010 | 1792.86 | 1882.71 | 1876.85 | BUY MODE |
SUZLON | 9/20/2010 | 51.68 | 55.76 | 56.65 | BUY MODE |
TATAMOTORS | 9/20/2010 | 995.43 | 1048.88 | 1057.45 | BUY MODE |
TATAPOWER | 9/20/2010 | 1283.03 | 1266.39 | 1264.2 | SELL MODE |
TATASTEEL | 9/20/2010 | 580.67 | 613.11 | 618 | BUY MODE |
TCS | 9/20/2010 | 871.83 | 914.46 | 912.25 | BUY MODE |
UNITECH | 9/20/2010 | 83.6 | 87.94 | 88.1 | BUY MODE |
WIPRO | 9/20/2010 | 407.32 | 421.51 | 420.35 | BUY MODE |
Note : Dont use this to make buy or sell decision… as the last buy signal date is not mentioned in the Exploration as of now. It can be only use to identify SAR(Stop Loss and Reversal) for any kind of trade.
Thanks..
getting compilation error on ab3.1 ” you must not access array elements outside 0 .(Barcount-1) range.
Please help.
thx.
sorry. it was in ab5.31
I have amibroker software, can you help me out ,for writing nma scan for nifty and other stocks ,Iam ready to for the charges
Already the AFL code supports Scanning,,, Now the explorer funtionallity is incorporated
thx sir once again a good work
Sir I have a question, if xyz stock has closed at 1600 and sar is at 1508 and ha close is at 1623 and signal is buy mode, then i should buy at 1600 which was the closing but what should be my stop loss, as sar is at 1508 and hclose is at 1623 but today closing is 1600 then what to do?
In short how to take advantage of the same
Thx
dear sir,
would u please guide me how 2 use Amibroker A-Z.
I dont know…..pls help me.
regards vijayan,kumbakonam.
Sir GE ! Today I have downloaded the NMA Swing Explorer.afl it’s GOOD. While EXPLORE it gives only BUY and not SELL, even in the SELL column it gives only BUY. It’s by looking the RED COLOUR I have identified. It’s my humble request can you change and give the NEW AFL. Thank you so much. with regards.
Yeh Akki its a Buy Signal at Rs 1600 with stop loss of SAR level at Rs1508 even though HA close points to 1623
Great work !
God bless u dear.
Not able to download NMA swing explore. getting error.
plz guide.
Regards,
sharad.
whether NMA swing explorer is available for metastock or whether its is possible to convert afl to MQ4 format
@Trader2y NMA Swing Explorer Currently Supports only Amibroker…. And for MQL4 try searching for NRTR trading system
sir ,
what is the best k & atr value , for intra day trade nifty , that gives 7-8 pts aftr the signal , not more is must , just 7-8 pts. tx in adv
@Jitin bactest with 1.75,10 that would be better
@ Eavaran
Try changing the for loop to
for(i = 1; i <= BarCount-1; i++) This could possibly solve your problem
Dear Sir,
With respect to your suggestion as follows :
” So if HaClose is greater than trailing ATR stop loss then it is a Buy
Signal else it would be the sell signal. ”
Kindly let me know the procedure to calculate the trailing ATR stop loss.
Appreciate your time and efforts.
Best regards,
CT
[email protected]
Sir would like to share a afl which can scan hns pattern would like if you share it with all here is the code
have back tested the same and its working fine hope you like it sir
x = Cum(1);
per = 5;
back=50;
inter=100;
s11=H;s12=L;
/* H & S */
pR = PeakBars( s11, per, 1 ) == 0;
endt1= LastValue(ValueWhen( pR, x, 1 ));
medt1=LastValue(ValueWhen( pR, x, 2 ));
startt1=LastValue(ValueWhen( pR, x, 3 ));
dt1=endt1-startt1;
C1=x==endt1 OR x==medt1 OR x==startt1;
endR = LastValue(ValueWhen( pR, s11, 1 ) );
medR=LastValue(ValueWhen( pR, s11, 2 ) );
startR = LastValue( ValueWhen( pR, s11, 3 ));
Filter1=medR>endR AND medR>startR AND abs(startR-endR)<0.02*(startR+endR) AND dt1LastValue(x)-back;
MaxGraph=10;Graph1=C;Graph1Style=64;GraphXSpace=5;
/*H&S Neck Line*/
Aper=medt1-startt1;bper=endt1-medt1;
La= LastValue(ValueWhen(x==medt1,LLV(L,Aper)));
Lb=LastValue(ValueWhen(x==-1+endt1,LLV(L,bper)));
Fa=L==La AND x>startt1 AND xmedt1 AND xstartt-5,trendlineS,-1e10);Graph3BarColor=7;
/*Inverted H & S*/
tpR = TroughBars( s12, per, 1 ) == 0;
tendt1=LastValue(ValueWhen(tpr,x,1));
tmedt1=LastValue(ValueWhen(tpr,x,2));
tstartt1=LastValue(ValueWhen(tpr,x,3));
tdt1=tendt1-tstartt1;
C2=x==tendt1 OR x==tmedt1 OR x==tstartt1;
tendR = LastValue(ValueWhen( tpR, s12, 1 ) );
tmedR=LastValue(ValueWhen( tpR, s12, 2 ) );
tstartR = LastValue( ValueWhen( tpR, s12, 3 ));
Filter2=tmedR<tendR AND tmedR<tstartR AND abs(tstartR-tendR)<0.02*(tstartR+tendR) AND tdt1LastValue(x)-back;
Graph1BarColor=IIf(C1 AND Filter1,7,IIf(C2 AND Filter2,10,1));
/*Inverted H&S Neck Line*/
tAper=tmedt1-tstartt1;tbper=tendt1-tmedt1;
Ha= LastValue(ValueWhen(x==tmedt1,HHV(H,tAper)));
Hb=LastValue(ValueWhen(x==-1+tendt1,HHV(H,tbper)));
tFa=H==Ha AND x>tstartt1 AND xtmedt1 AND xRstartt-5,trendlineR,-1e10);Graph4BarColor=10;
Filter=Filter1 OR Filter2;
NumColumns=2;/*Graph2=x==-1+tendt1;*/
Column0=Filter1;
Column1=Filter2;
Column0Format=Column1Format=1.0;
Column0Name=”H&S”;
Column1Name=”inv H&S”;
This is another code which can scan the cup and handle formation hope it benefits to any one
MinPrice=20;
MinVolume=100000;
//Left side of Handle formation can occur anywhere from 2-25days – look at the last 25 bars and get the number of bars since condition met.
LH=HHV(Close,25); // Highest close past 25 days.
BLH=HHVBars(Close,25); // Tells us # of bars that have past since high reached. Used to determine lowest bar.
BH=LLV(Close,BLH); // Lowest close since the highest value was reached/
BBH=LLVBars(Close,BLH); // number of bars that have past since lowest value.
NBLH=BLH-BBH; // this is the number of bars in the formation of the left side handle. NBLH must be atleast 2 to be a valid handle formation.
// Now lets get the cup formation. Cup formation can occur anywhere from 23 to 145 days. The left side of the cup can be from 20-120 days and the right side can be anywhere from 3-25 days.
// get the right side of the cup(low).
BC=LLV(Close,BLH+25); // look at 25 bars since the left side of handle.
BBC=LLVBars(Close,BLH+25);
// get the left side of the cup.
LC=Ref(HHV(Close,120),BBC*-1);
BLC=Ref(HHVBars(Close,120),BBC*-1);
// Get highest value before left side of cup started to form.
KC=Ref(HHV(Close,30),BLC*-1);
BKC=Ref(HHVBars(Close,120),BLC*-1);
Delta= LC/KC;
//Calculate the up/down relative price value during time frame RC (Right Cup Formation)
URPV=DRPV=0;
i=EndValue(BLH);
j=EndValue(BBC);
do
{
URPV = IIf(Ref(Close,i*-1)>Ref(Close,(i+1)*-1),Ref(Volume,(i*-1))*Ref(Close,(i*-1))-Ref(Close,(i+1)*-1),URPV);
DRPV = IIf(Ref(Close,i*-1)<Ref(Close,(i+1)*-1),Ref(Volume,(i*-1))*Ref(Close,(i+1)*-1)-Ref(Close,(i*-1)),DRPV);
i++;
} while (i1
// Calculate Beta
DRPV=0;
i=EndValue(BBH);
j=EndValue(BLH);
do
{
DRPV = IIf(Ref(Close,i*-1)<Ref(Close,(i+1)*-1),Ref(Volume,(i*-1))*Ref(Close,(i+1)*-1)-Ref(Close,(i*-1)),DRPV);
i++;
} while (i2
// 2. Bottom of the cup must be lower than the left top of the cup.
// 3. Left handle must be lower than or equal to the lect cup formation.
// 4. Bottom of the cup must be less than the left handle.
// 5. Bottom of the handle must be > 80% of the left handle + 20% of the bottom cup.
// 6. Start of cup/handle formation must be greater than precedding chart value. LC>LC
// 7. Minimum price and volume you can set any way you like.
Filter= NBLH>2 AND Close>BH AND BC<LC AND LH<=LC AND BC<LH AND BH.8*LH+.2*BC AND KCMinPrice AND MA(Volume,30)>MinVolume;
Rajandran sir you have been doing a great job and just wanted to add on some notes 🙂 hope the family is benefited
Sir one more thing can you share a afl code which can scan stocks which are near to LC & UC bands, both the stocks nse and bse, plz?
Thanks
14.10.2010
Hai! Mr. Rajandran,
Using it by double clicking on it and it displays the chart.
Is it possible to make the AFL such that it scans all the stocks in AmiBroker (100+) and gives an alert when a buy signal or a sell signal is generated in HOURLY charts?
Looking forward to an early reply from your end.
Best Regards,
Kartheek D. N.
@Kartheek Yes it is possible to scan n number of stocks using any trading system… Try Automatic Analysis in Amibroker
akki thanx but as i use ami trial , so does ur afl plot these pattern on chart?
15.10.2010
Dear Mr. Rajandran,
Thank you for your reply. When using Automatic Analysis using Explore function, get to know which is in BUY MODE and which is in SELL MODE.
Here in AmiBroker, have set the chart to display in HOURLY view. Sometimes, a buy signal/arrow or a sell signal/arrow is shown in the HOURLY chart. Each stock has to be clicked separately to see if any signal/arrow is showing.
So, is it possible for you to add a few lines of code in the AFL to show automatically that a buy signal/arrow or a sell signal/arrow has been generated in the HOURLY charts when it scans in Automatic Analysis under Explore function and post the AFL here to download?
Looking forward to hearing from you at the earliest.
Best Regards,
Kartheek D. N.
Hi Rajendran:
As I don’t have Amibroker charting backage, is it possible to create a Excell spread sheet to create these signals based on daily O/H/L/C input?
Aprreciate your help.
Regards,
Raj
I think it would be possible with Ta-Lib Excel Addon+ Little VBA script
Afl for kaji charts shows some error. What to do?
When N.M.A’s from given & details .