MK NIFTY Options Trading System -I AFL (Amibroker kit)

Here is the Amibroker AFL for MK NIFTY Options Trading System  It draws SL and trailing SL line.

Please read trading rules here.
It will also give notification on speakers for buy and sell signals.


// MK Options Trader for NIFTY Options.
// By Maheshwar Kanitkar 1-8-2012.
_SECTION_BEGIN(“Options Trader”);

_N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C, SelectedValue( ROC( C, 1
) ) ));

//STOP LOSS code
//The formula draws a stoploss loss line which will be 2% below the Highest Close within a lookback period of 5 bars.
//You can change these parameters.

lookbackPeriod = Param(“Lookback period”, 5, 1, 30);
stoplossPercentage = Param(“Stoploss Percentage”, 3, 2, 10);
TrailingSL= HHV(C,lookbackPeriod) – HHV(C,lookbackPeriod) * (stoplossPercentage / 100) ;
//Plot(HHV(C,lookbackPeriod) – HHV(C,lookbackPeriod) * (stoplossPercentage / 100), “TrailingSL”, ParamColor( “Color”, colorCycle ));
Plot(TrailingSL, “TrailingSL”, ParamColor( “Color”, colorCycle ));

// end of stop loss code.

ea = EMA (C,3);
eb = EMA (C,13);
SetBarFillColor( IIf( ea > eb, colorGreen, colorRed ) );
Plot( C, “Price”, IIf( ea > eb, colorGreen, colorRed ), styleCandle );
Buy = ea > eb AND TimeNum() > 092000 AND TimeNum() < 150000;
Sell = eb > ea OR TimeNum() > 150000;
Short = 0;
Cover = 0;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);

// Code to plot signals
dist = 1.5*ATR(10);
for( i = 0; i < BarCount; i++ )
if( Buy[i] ) PlotText( “Buy Signal\n@” + C[ i ], i, L[ i ]-dist[i],colorWhite, colorBlue );

if( Sell[i] ) PlotText( “Sell Signal\n@ ” + C[ i ], i, H[ i ]+dist[i],colorRed, colorYellow );
//if( Short[i] ) PlotText( “Short\n@” + C[ i ], i, H[ i ]+dist[i], colorRed, colorYellow );
//if( Cover[i] ) PlotText( “Cover\n@” + C[ i ], i, L[ i ]-dist[i],colorGreen );
PlotShapes( Buy * shapeUpTriangle + Sell* shapeDownTriangle, IIf( Buy,colorYellow, colorYellow ) );
// PlotShapes( Sell * shapeDownTriangle + Sell * shapeDownTriangle, IIf( Buy,colorGreen, colorRed ) );
// Sound – please remove comments below with right path to wave files.
//AlertIf( Buy, “SOUND c:\\Windows\\Media\\chimes.wav”, “Buy alert”, 2 );
//AlertIf( Sell, “SOUND c:\\Windows\\Media\\chimes.wav”, “Sell alert”, 3 );
// Interpretation Data
// Maheshwar Kanitkar 2012.
printf(“Welcome to MK Options Trading system help:\n”);
_N( tname = Name()+”(“+FullName()+”)” );
printf( tname + ” has closed ” + WriteIf( EMA (Close,3) > EMA (Close,13), “above medium term moving avg, this is Buy signal.\n” , “below medium term
moving avg, this is Sell signal.\n” ) + ” Follow the trading rules. “);
printf(“Trading rules – Buy on Green candle, SL is redline, Once position is in Profit, book profit once prices touches redline, Sell if position goes below redline
or Candle becomes red.”);




7 Comments to “MK NIFTY Options Trading System -I AFL (Amibroker kit)”

  1. Ravi Naik says:

    Hallo Sir,
    Your system is simple & easy to undrtstand.I dnloaded the formula from .Even on regular price chart the systems seems to give decent return.
    thanks for sharing yr inventions.
    ravi naik

  2. Alok says:

    i downloaded the formula but the chart is blank, can you assist. i have AMi 5.50.5

  3. Prashant alai says:

    Dear sir
    i am download your Option Trading Formula but it is not working ans error 31 come there so pls mail me clear code of this formula.

    Thanks and Regards

  4. Debdeep says:

    Dear Kanitkar,
    I copied and pasted the formula from the above but for me it is throwing syntax error. Requesting you to kindly ook into this issue.
    Thanks in advance for your help.

    • admin says:

      Can you please provide error details?
      Please also search for following lines
      AlertIf( Buy, “SOUND c:\Windows\Media\chimes.wav”, “Buy alert”, 2 );
      AlertIf( Sell, “SOUND c:\Windows\Media\chimes.wav”, “Sell alert”, 3 );
      and mark it as
      // AlertIf( Buy, “SOUND c:\Windows\Media\chimes.wav”, “Buy alert”, 2 );
      // AlertIf( Sell, “SOUND c:\Windows\Media\chimes.wav”, “Sell alert”, 3 );

  5. albert says:

    I need software with buy/sell/stoploss sound alert.
    If ,I have a amibroker software ,can you install
    buy/sell sound alerts.Pls give your valuable advise
    bye Albert

Leave a Reply

Your email address will not be published. Required fields are marked *


This entry was posted on August 14, 2012 and is filed under Trading Systems. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.