Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

NMA Swing Explorer

42 sec read

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.

TickerDate/TimeSARHA CloseCloseMODE
ABB9/20/2010820.7855.85864.2BUY MODE
ACC9/20/2010953.261010.251021.1BUY MODE
AMBUJACEM9/20/2010134.6144.6145.45BUY MODE
AXISBANK9/20/20101435.91526.761546.85BUY MODE
BHARTIARTL9/20/2010342.56364.24365.95BUY MODE
BHEL9/20/20102418.012444.562442.55BUY MODE
BPCL9/20/2010729.89782.66802.15BUY MODE
CAIRN9/20/2010329.1342.61343.75BUY MODE
CIPLA9/20/2010318.27313.41315.95SELL MODE
DLF9/20/2010337.34358.23365.65BUY MODE
GAIL9/20/2010454.35482.05480BUY MODE
HCLTECH9/20/2010395.37420.7422.1BUY MODE
HDFC9/20/2010661.8697.58706.3BUY MODE
HDFCBANK9/20/20102331.952428.912446.2BUY MODE
HEROHONDA9/20/20101809.471787.591821.25SELL MODE
HINDALCO9/20/2010178.78191.28193.95BUY MODE
HINDUNILVR9/20/2010276.67288.42293.2BUY MODE
ICICIBANK9/20/20101071.331120.381127.75BUY MODE
IDEA9/20/201072.2177.2476.75BUY MODE
IDFC9/20/2010186.66194.05195.1BUY MO...
INFOSYSTCH9/20/20102896.482994.153008.6BUY MODE
ITC9/20/2010164.77172.91176.65BUY MODE
JINDALSTEL9/20/2010688.49711.76712.65BUY MODE
JPASSOCIAT9/20/2010118.26123.69124.9BUY MODE
KOTAKBANK9/20/2010450.09476.13474.75BUY MODE
LT9/20/20101913.981983.32000.05BUY MODE
M&M9/20/2010653.09685.42687.8BUY MODE
MARUTI9/20/20101333.051393.471398.9BUY MODE
NTPC9/20/2010198.21206.13205.3BUY MODE
ONGC9/20/20101346.361407.551404.2BUY MODE
PNB9/20/20101226.551291.931290.7BUY MODE
POWERGRID9/20/2010103.34105.78105.65BUY MODE
RANBAXY9/20/2010505.49533.91532.25BUY MODE
RELIANCE9/20/2010990.971033.861041.4BUY MODE
RELINFRA9/20/20101023.81078.21087.55BUY MODE
RPOWER9/20/2010154.71162.06162.45BUY MODE
SAIL9/20/2010195.02203.64205.3BUY MODE
SBIN9/20/20102976.583101.93108.9BUY MODE
SIEMENS9/20/2010728.57759.06763.45BUY MODE
STER9/20/2010162.56172.95172.15BUY MODE
SUNPHARMA9/20/20101792.861882.711876.85BUY MODE
SUZLON9/20/201051.6855.7656.65BUY MODE
TATAMOTORS9/20/2010995.431048.881057.45BUY MODE
TATAPOWER9/20/20101283.031266.391264.2SELL MODE
TATASTEEL9/20/2010580.67613.11618BUY MODE
TCS9/20/2010871.83914.46912.25BUY MODE
UNITECH9/20/201083.687.9488.1BUY MODE
WIPRO9/20/2010407.32421.51420.35BUY 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.

Download NMA Swing Explorer

Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

Amibroker Execution Module – Hedged Index Futures for Directional…

In the last tutorial, we learn the importance of Hedging Futures Position with OTM Options for Reduced Margin. This tutorial focus on how to...
Rajandran R
14 min read

Multi Legged Options Execution – Amibroker Module – Button…

This tutorial provides you a basic framework for sending multi-legged options module and how to exit the multi-legged option module using a simple button...
Rajandran R
8 min read

Sending Option Orders and Exiting Option Orders in Algomojo…

This tutorial helps you to understand the options trading module and the requirements to set up and send and exit option orders from Amibroker...
Rajandran R
5 min read

28 Replies to “NMA Swing Explorer”

  1. getting compilation error on ab3.1 ” you must not access array elements outside 0 .(Barcount-1) range.

    Please help.
    thx.

  2. I have amibroker software, can you help me out ,for writing nma scan for nifty and other stocks ,Iam ready to for the charges

  3. 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

  4. dear sir,
    would u please guide me how 2 use Amibroker A-Z.
    I dont know…..pls help me.
    regards vijayan,kumbakonam.

  5. 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.

  6. Great work !

    God bless u dear.

    Not able to download NMA swing explore. getting error.
    plz guide.

    Regards,
    sharad.

  7. whether NMA swing explorer is available for metastock or whether its is possible to convert afl to MQ4 format

  8. 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

  9. 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
    carnot11@gmail.com

  10. 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”;

  11. 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;

  12. 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

  13. 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.

  14. 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.

  15. 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

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More