Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

A look into Jan 2008 Call Options

21 sec read

Chart shown here is the 23 days of 5800 CE, 5900CE, 6000CE, 6100CE, 6200CE, 6300CE, 6400CE historical Open Interest data during the entire Jan 2008 Session. The Blue bar is the open interest data & the red bar signifies the change in open interest data for a particular day/session. Black line is nothing but the Option strike price. When compared to Jan 2008 Open Interest built up the current Open Interest builtup these days is almost 4-5 times bigger. Nowadays it seems too much participation in options market

These charts often remind us that Naked longs in puts/calls are always dangerous.


[wp_ad_camp_5]

 

Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

Nifty Short-Term Trend Turning Negative – Market Profile Update

The short-term trend for Nifty appears to be shifting towards the negative, encountering intermediate resistance in the range of 21920-21950. Additionally, a top-down analysis...
Rajandran R
1 min read

Nifty Futures – Short-Term Overview – Feb 2024 Futures

Nifty Futures is a short term is likely to test the G2 High reference level around 22200. Short Term Supports are formed around the...
Rajandran R
46 sec read

Nifty Sentiment likely to turn Positive?

Nifty Futures is likely to have a short truncated week. And last Saturday's trading session showed a comeback of Bank Nifty despite Nifty Futures...
Rajandran R
31 sec read

12 Replies to “A look into Jan 2008 Call Options”

  1. Dear mr. rajandran,

    here is an afl code , but its giving some errors in 5.30 ver of ami , can u plz look into the code and rectify it . tx in adv.

    _SECTION_BEGIN(“P&F Daily”);
    //AFL P&F Chart for Amibroker Indicator window. Based on High/low prices.
    //Based on code in AB help files
    //Reverse is 2 boxes.
    //Graham Kavanagh 30 Sep 2003

    Version(4.40);
    SetBarsRequired(100000,100000);

    //Size for P&F boxes
    boxsize=IIf(C>=0.01 AND C=10 AND C=20 AND C=30 AND C=40 AND C=50 AND C=60 AND C=70 AND C=80 AND C=90 AND C=100 AND C=150 AND C=200 AND C=250 AND C=300 AND C=350 AND C=400 AND C=450 AND C=500 AND C=550 AND C=600 AND C=650 AND C=700 AND C=750 AND C=800 AND C=850 AND C=900 AND C=950 AND C=1000 AND C=1100 AND C=1200 AND C=1300 AND C=1400 AND C=1500 AND C=1600 AND C=1700 AND C=1800 AND C=1900 AND C=2000 AND C=2100 AND C=2200 AND C=2300 AND C=2400 AND C=2500 AND C=2600 AND C=2700 AND C=2800 AND C=2900 AND C=3000 AND C=3100 AND C=3200 AND C=3300 AND C=3400 AND C=3500 AND C=3600 AND C=3700 AND C=3800 AND C=3900 AND C=4000 AND C=4100 AND C=4200 AND C=4300 AND C=4400 AND C=4500 AND C=4600 AND C=4700 AND C=4800 AND C=4900 AND C=5000 AND C=6000 AND C=7000 AND C=8000 AND C=9000 AND C=10000 AND C=11000 AND C=12000 AND C=13000 AND C=14000 AND C=15000 AND C=16000 AND C=17000 AND C=18000 AND C=19000 AND C=20000 AND C=21000 AND C=22000 AND C=23000 AND C=24000 AND C=25000 AND C=26000 AND C=27000 AND C=28000 AND C=29000 AND C=30000 AND C=31000 AND C=32000 AND C=33000 AND C=34000 AND C<35000, 175,
    200
    ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
    Box = LastValue(boxsize);
    HX = round((H/box)*10)/10;
    LX = round((L/box)*10)/10;
    RH = floor(HX);
    FL = ceil(LX);

    // initialize first element
    j = 0;

    Reverse = 3; // reversal requirement

    PFC[j] = FL[0];
    PFO[j] = PFC[j] + 1;
    down = 1; // By default the first bar is a down bar.
    up = 0;
    swap = 0;

    // perform the loop that produces PF Chart
    for( i = 1; i = PFC[j] + 1 && up) //Continue up
    {
    PFC[j] = RH[i];
    PFO[j] = PFC[j] – 1;
    }
    else
    {
    if( FL[i] Ref(PFO,-1),Ref(HHV(PFC,1),-1)-1,Max(PFO,PFC))*Box;
    L = IIf(Ref(PFC,-1)Ref(PFO,-1),Ref(HHV(PFC,1),-1)-1,IIf(Ref(PFC,-1) PFO, 1,-1);

    GraphXSpace = 2;
    Title =”No Jscript ” + Name()+ ” PF HiLo, H: ” + H+ “, L: ” + L+”, Box: “+
    box + “, Reversal: ” + reverse;

    Plot( C, “P&F Chart Close”, IIf( PFC > PFO, colorBlue, colorRed ),
    styleCandle+styleNoLabel+stylePointAndFigure);

    hbar1 = H ;
    hbar2 = Ref(H,-2) ;

    lbar1 = L ;
    lbar2 = Ref(L,-2) ;

    Buy = IIf( hbar1 > hbar2 AND PFC > PFO ,True,False);
    Sell = IIf(lbar1 < lbar2 AND PFC < PFO ,True,False);

    x = Buy;
    y = Sell;

    Buy = ExRem( Buy, Sell );
    Sell = ExRem( Sell, Buy );

    PlotShapes(shapeSmallUpTriangle * Buy, colorGreen, 0, L, -12);
    PlotShapes(shapeSmallDownTriangle * Sell, colorRed, 0, H, -12);

    " Last Bar " + LastValue( BarIndex()-2 );

    AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Sell", 2 );
    AlertIf( Buy, "SOUND C:\\Windows\\Media\\Ding.wav", "Buy", 1 );

    Filter = 1; /* all symbols and quotes accepted */
    //filer = Buy OR Sell ;
    AddColumn(Open,"OPEN",1);
    AddColumn(High,"HIGH",1);
    AddColumn(Low,"LOW",1);
    AddColumn(Close,"CLOSE",1);
    AddColumn(V,"VOLUME",1);
    AddColumn(x,"Buy Above" , 1);
    AddColumn(y,"Sell Below", 1);
    AddColumn(hbar2,"Hbar-2", 1);

    _SECTION_END();

    _SECTION_BEGIN( "Point & Figure w Values adj" );

    GraphXSpace = 5;

    SetChartBkColor( ParamColor( "BackGroundColor", colorBlack) );

    //GraphColor = ParamColor("GarphColor",colorLightGrey);

    GridColor = ParamColor( "GridColor", colorLightGrey );

    Scaling = ParamList( "Scaling Method", "Traditional|Percentage|AVG True
    Range" );

    if ( scaling == "Traditional" )

    Box = Param( "Box", 1, 0.2, 10, 0.1 );

    else

    if ( scaling == "Percentage" )

    Box = Param( "Box ", 1, 0.2, 10, 0.1 ) / 100 * LastValue( C );

    else

    if ( scaling == "AVG True Range" )

    Box = Param( "Box", 1, 0.3, 5, 0.1 ) * LastValue( ATR ( 20 ) );

    shiftChart = 0;

    shiftLastClose = 1;

    shiftGrid = 7;

    shiftPriceAxis = 2;

    Reverse = Param( "Reverse", 3, 1, 5 );

    j = 0;

    PFL[0] = Box * ceil( Low[0] / Box ) + Box;

    PFH[0] = Box * floor( High[0] / Box );

    direction = 0;

    for ( i = 1; i = PFH[j] + Box )

    {

    PFH[j] = Box * floor( High[i] / Box );

    }

    else

    {

    if ( Low[i] 0, SelectedValue( Hi ) – box / 2, SelectedValue( Lo
    ) + box / 2 );

    //———————————————————————–

    // GRID CONSTRUCTION

    //———————————————————————-

    PlotGridLines = ParamToggle( “PlotdGrid”, “Yes! |No”, 1 ) ;

    if ( PlotGridLines )

    {

    begin = SelectedValue( BarIndex() );

    end = LastValue( BarIndex() );

    period = end – begin + 1;

    if ( begin = begin, IIf( direction == 1, screenHigh,
    screenLow ), Null );

    Plot ( VerticalGrid, “”, gridColor, styleStaircase | styleNoLabel, 0, 0, 1
    );

    format = 8.2;

    for ( n = LastValue( bot ); n =0; i–)

    {

    for (j = 1; j inlist[j] AND inlist[j-1] > 0)

    {

    temp = inlist[j-1];

    inlist[j-1] = inlist[j];

    inlist[j] = temp;

    }

    }

    }

    //inlist now sorted

    return inlist;
    }

    //Support and resistance levels.

    //using RSI

    //Load into Indicator Builder

    //Sensitivity of the levels can be changed with the variables

    //Can test different numbers live with the Param function ctrl-R with open
    pane

    RSIperiod = Param(“RSI p”,2,2,30,1);

    EMAperiod = Param(“EMA p”,5,3,10,1);

    Percent = Param(“ZIG %”,3,1,15,1);

    HHVperiod = Param(“HHV p”,6,2,10,1);

    NumLine = Param(“Num Lines”,2,1,20,1);

    //Base = RSI(RSIperiod);

    //Base = EMA(RSI(RSIperiod),EMAperiod);
    //base = CCI(14);
    Base = DEMA(RSI(RSIperiod),EMAperiod);

    GraphXSpace=0.5;

    //Plot(EMA(C, 10), “EMA-10″, colorRed, styleLine|styleThick|styleNoRescale);
    //Plot(EMA(C, 20), “EMA-20″, colorBlue, styleLine|styleThick|styleNoRescale);
    //Plot(EMA(C, 50), “EMA-50″, colorBlack, styleLine|styleThick|styleNoRescale);

    pp = (H + L + C)/3;
    //Plot(EMA(Ref(pp, -1), 3), “EMA pp”, colorWhite, styleLine|styleNoRescale);

    red = green = 0;
    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|styleNoRescale);
    Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen,
    styleLine|styleNoRescale);
    red = IIf(resbase == base, 1, 0);
    green = IIf(supbase == base, 1, 0);
    }

    r1[1] = 0;
    s1[1] = 0;
    for (i = 1; i = 1; i–)
    {
    if (r1[i] 0)
    {
    near_s1[j] = r1[i];
    j++;
    }
    }


    Current Low: ” + WriteVal(L, 1.2);

    Nearest Support Levels:
    ”;
    “S1: ” + WriteVal(near_s1[1], 1.2);
    “S2: ” + WriteVal(near_s1[2], 1.2);

    // Test
    /*
    resbase = LastValue(Peak(base, percent, 1));
    supbase = LastValue(Trough(base, percent, 1));
    sup1 = ValueWhen(supbase==base, LLV(L, HHVperiod));
    res1 = ValueWhen(resbase==base, HHV(H, HHVperiod));
    “Resbase: ” + WriteVal(resbase, 1.2);
    “SUpbase: ” + WriteVal(supbase, 1.2);
    “Supp1: ” + WriteVal(sup1, 1.2);
    “Res1: ” + WriteVal(res1, 1.2);

    resbase = LastValue(Peak(base, percent, 2));
    supbase = LastValue(Trough(base, percent, 2));
    sup1 = ValueWhen(supbase==base, LLV(L, HHVperiod));
    res1 = ValueWhen(resbase==base, HHV(H, HHVperiod));

    ”;
    “Resbase2: ” + WriteVal(resbase, 1.2);
    “SUpbase2: ” + WriteVal(supbase, 1.2);
    “Supp2: ” + WriteVal(sup1, 1.2);
    “Res2: ” + WriteVal(res1, 1.2);

    resbase = LastValue(Peak(base, percent, 3));
    supbase = LastValue(Trough(base, percent, 3));
    sup1 = ValueWhen(supbase==base, LLV(L, HHVperiod));
    res1 = ValueWhen(resbase==base, HHV(H, HHVperiod));

    ”;
    “Resbase3: ” + WriteVal(resbase, 1.2);
    “SUpbase3: ” + WriteVal(supbase, 1.2);
    “Supp3: ” + WriteVal(sup1, 1.2);
    “Res3: ” + WriteVal(res1, 1.2);

    // End test

    ”;
    “Base: ” + WriteVal(base, 1.2);
    WriteIf(red, “Resistance”, “”);
    WriteIf(green, “Support”, “”);

    ”;

    */

    ”;
    Title = Name() + “; ” + Date() + “: Support & Resistance Levels using RSI: ” +
    EncodeColor(colorGreen)+ “Support Levels are Green; “+EncodeColor(colorRed)+
    “Resistance Levels are Red: “+EncodeColor(colorBlack)+”Number of lines of each
    =”+WriteVal(numline,1) +
    EncodeColor(colorRed) + “
    EMA-10: ” + WriteVal(EMA(C, 10), 1.2) +
    EncodeColor(colorBlue) + “
    EMA-20: ” + WriteVal(EMA(C, 20), 1.2) +
    EncodeColor(colorBlack) + “
    EMA-50: ” + WriteVal(EMA(C, 50), 1.2) ;

    SetChartBkGradientFill( ParamColor(“BgTop”, colorTeal),ParamColor(“BgBottom”,
    colorLightGrey));

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

    Hh = HHV(C,1) ;
    Ll = LLV(C,1) ;

    Hh = Ref(HHV(C,1),-1) ;
    Ll = Ref(LLV(C,1),-1);

    //Plot(Hh,”1 Bar High”,colorGreen,styleLine);
    //Plot(Ll,”1 Bar Low”,colorRed,styleLine);

    Plot(Close,”Close”,
    IIf(C > Hh, colorBrightGreen,
    IIf(C Hh;
    Sell = C < Ll;

    Buy = ExRem( Buy, Sell );
    Sell = ExRem( Sell, Buy );

    PlotShapes(shapeUpTriangle* Buy, colorGreen, 0, L );
    PlotShapes(shapeDownTriangle* Sell, colorRed, 0, H );
    "Jeevan's Advice: "+WriteVal(0);
    "Bullish if Closing Above : "+WriteVal(Hh,1.01);
    "Bearish if Closing Below: "+WriteVal(Ll,1.01);
    "Current Close : "+WriteVal(Close,1.0);

    _SECTION_END();

  2. hi sir
    i have read almost all ur posts n they are indeed very helpful to many mainly amibroker users
    sir i urge to post one more post regarding how to use AUX1 n AUX2 on charts as array in amibroker 5.30 as i searched alot for it but didnt found any solution to it
    plz due post the afl codes so that people can access to aux fuction on chart scan and explore

    regards
    ankit

  3. hi jitin
    u have got wrong in making code of box size i have rectified it and providing a new one as i dont really trade on point and figure charts but i advice u to have luk on point and figure charts in fcharts, metastock, incredible charts and bulls eye software along with ur reading materials on it as i heard by someone that a perfect PNF need to have proper box size adjustments as per calculation in which amibroker codes cant perfect it so luk for some specific software for it. i have other 4 PNF modified codes also if u need due give ur id i will transfer it.
    codes are as below

    _SECTION_BEGIN(“P&F Daily”);
    //AFL P&F Chart for Amibroker Indicator window. Based on High/low prices.
    //Based on code in AB help files
    //Reverse is 2 boxes.
    //Graham Kavanagh 30 Sep 2003

    Version(4.40);
    SetBarsRequired(100000,100000);

    //Size for P&F boxes
    boxsize=IIf(C>=0.01 AND C=10 AND C=20 AND C=30 AND C=40 AND C=50 AND C=60 AND C=70 AND C=80 AND C=90 AND C=100 AND C=150 AND C=200 AND C=250 AND C=300 AND C=350 AND C=400 AND C=450 AND C=500 AND C=550 AND C=600 AND C=650 AND C=700 AND C=750 AND C=800 AND C=850 AND C=900 AND C=950 AND C=1000 AND C=1100 AND C=1200 AND C=1300 AND C=1400 AND C=1500 AND C=1600 AND C=1700 AND C=1800 AND C=1900 AND C=2000 AND C=2100 AND C=2200 AND C=2300 AND C=2400 AND C=2500 AND C=2600 AND C=2700 AND C=2800 AND C=2900 AND C=3000 AND C=3100 AND C=3200 AND C=3300 AND C=3400 AND C=3500 AND C=3600 AND C=3700 AND C=3800 AND C=3900 AND C=4000 AND C=4100 AND C=4200 AND C=4300 AND C=4400 AND C=4500 AND C=4600 AND C=4700 AND C=4800 AND C=4900 AND C=5000 AND C=6000 AND C=7000 AND C=8000 AND C=9000 AND C=10000 AND C=11000 AND C=12000 AND C=13000 AND C=14000 AND C=15000 AND C=16000 AND C=17000 AND C=18000 AND C=19000 AND C=20000 AND C=21000 AND C=22000 AND C=23000 AND C=24000 AND C=25000 AND C=26000 AND C=27000 AND C=28000 AND C=29000 AND C=30000 AND C=31000 AND C=32000 AND C=33000 AND C=34000 AND C<35000, 175,
    200 )))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))))))))))))))))));
    Box = LastValue(boxsize);
    HX = round((H/box)*10)/10;
    LX = round((L/box)*10)/10;
    RH = floor(HX);
    FL = ceil(LX);

    // initialize first element
    j = 0;

    Reverse = 3; // reversal requirement

    PFC[j] = FL[0];
    PFO[j] = PFC[j] + 1;
    down = 1; // By default the first bar is a down bar.
    up = 0;
    swap = 0;

    // perform the loop that produces PF Chart
    for( i = 1; i < BarCount; i++ )
    {

    if( FL[i] = PFC[j] + Reverse && down) //Change direction to up
    {
    j++;
    swap = 1;
    PFC[j] = RH[i];
    PFO[j] = PFC[j]-1;
    }
    }
    if( RH[i] >= PFC[j] + 1 && up) //Continue up
    {
    PFC[j] = RH[i];
    PFO[j] = PFC[j] – 1;
    }
    else
    {
    if( FL[i] Ref(PFO,-1),Ref(HHV(PFC,1),-1)-1,Max(PFO,PFC))*Box;
    L = IIf(Ref(PFC,-1)Ref(PFO,-1),Ref(HHV(PFC,1),-1)-1,IIf(Ref(PFC,-1) PFO, 1,-1);

    GraphXSpace = 2;
    Title =”No Jscript ” + Name()+ ” PF HiLo, H: ” + H+ “, L: ” + L+”, Box: “+ box + “, Reversal: ” + reverse;

    Plot( C, “P&F Chart Close”, IIf( PFC > PFO, colorBlue, colorRed ), styleCandle+styleNoLabel+stylePointAndFigure);

    hbar1 = H ;
    hbar2 = Ref(H,-2) ;

    lbar1 = L ;
    lbar2 = Ref(L,-2) ;

    Buy = IIf( hbar1 > hbar2 AND PFC > PFO ,True,False);
    Sell = IIf(lbar1 < lbar2 AND PFC < PFO ,True,False);

    x = Buy;
    y = Sell;

    Buy = ExRem( Buy, Sell );
    Sell = ExRem( Sell, Buy );

    PlotShapes(shapeSmallUpTriangle * Buy, colorGreen, 0, L, -12);
    PlotShapes(shapeSmallDownTriangle * Sell, colorRed, 0, H, -12);

    " Last Bar " + LastValue( BarIndex()-2 );

    AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Sell", 2 );
    AlertIf( Buy, "SOUND C:\\Windows\\Media\\Ding.wav", "Buy", 1 );

    Filter = 1; /* all symbols and quotes accepted */
    //filer = Buy OR Sell ;
    AddColumn(Open,"OPEN",1);
    AddColumn(High,"HIGH",1);
    AddColumn(Low,"LOW",1);
    AddColumn(Close,"CLOSE",1);
    AddColumn(V,"VOLUME",1);
    AddColumn(x,"Buy Above" , 1);
    AddColumn(y,"Sell Below", 1);
    AddColumn(hbar2,"Hbar-2", 1);

    _SECTION_END();

    _SECTION_BEGIN( "Point & Figure w Values adj" );

    GraphXSpace = 5;

    SetChartBkColor( ParamColor( "BackGroundColor", colorBlack) );

    //GraphColor = ParamColor("GarphColor",colorLightGrey);

    GridColor = ParamColor( "GridColor", colorLightGrey );

    Scaling = ParamList( "Scaling Method", "Traditional|Percentage|AVG True
    Range" );

    if ( scaling == "Traditional" )

    Box = Param( "Box", 1, 0.2, 10, 0.1 );

    else

    if ( scaling == "Percentage" )

    Box = Param( "Box ", 1, 0.2, 10, 0.1 ) / 100 * LastValue( C );

    else

    if ( scaling == "AVG True Range" )

    Box = Param( "Box", 1, 0.3, 5, 0.1 ) * LastValue( ATR ( 20 ) );

    shiftChart = 0;

    shiftLastClose = 1;

    shiftGrid = 7;

    shiftPriceAxis = 2;

    Reverse = Param( "Reverse", 3, 1, 5 );

    j = 0;

    PFL[0] = Box * ceil( Low[0] / Box ) + Box;

    PFH[0] = Box * floor( High[0] / Box );

    direction = 0;

    for ( i = 1; i < BarCount; i++ )

    {

    if ( direction[j] == 0 )

    {

    if ( Low[i] = PFL[j] + Reverse*Box )

    {

    j++;

    direction[j] = 1;

    PFH[j] = Box * floor( High[i] / Box );

    PFL[j] = PFL[j – 1] + Box;

    }

    }

    }

    else

    {

    if ( High[i] >= PFH[j] + Box )

    {

    PFH[j] = Box * floor( High[i] / Box );

    }

    else

    {

    if ( Low[i] 0, SelectedValue( Hi ) – box / 2, SelectedValue( Lo
    ) + box / 2 );

    //———————————————————————–

    // GRID CONSTRUCTION

    //———————————————————————-

    PlotGridLines = ParamToggle( “PlotdGrid”, “Yes! |No”, 1 ) ;

    if ( PlotGridLines )

    {

    begin = SelectedValue( BarIndex() );

    end = LastValue( BarIndex() );

    period = end – begin + 1;

    if ( begin = begin, IIf( direction == 1, screenHigh,
    screenLow ), Null );

    Plot ( VerticalGrid, “”, gridColor, styleStaircase | styleNoLabel, 0, 0, 1
    );

    format = 8.2;

    for ( n = LastValue( bot ); n =0; i–)

    {

    for (j = 1; j inlist[j] AND inlist[j-1] > 0)

    {

    temp = inlist[j-1];

    inlist[j-1] = inlist[j];

    inlist[j] = temp;

    }

    }

    }

    //inlist now sorted

    return inlist;
    }

    //Support and resistance levels.

    //using RSI

    //Load into Indicator Builder

    //Sensitivity of the levels can be changed with the variables

    //Can test different numbers live with the Param function ctrl-R with open pane

    RSIperiod = Param(“RSI p”,2,2,30,1);

    EMAperiod = Param(“EMA p”,5,3,10,1);

    Percent = Param(“ZIG %”,3,1,15,1);

    HHVperiod = Param(“HHV p”,6,2,10,1);

    NumLine = Param(“Num Lines”,2,1,20,1);

    //Base = RSI(RSIperiod);

    //Base = EMA(RSI(RSIperiod),EMAperiod);
    //base = CCI(14);
    Base = DEMA(RSI(RSIperiod),EMAperiod);

    GraphXSpace=0.5;

    //Plot(EMA(C, 10), “EMA-10”, colorRed, styleLine|styleThick|styleNoRescale);
    //Plot(EMA(C, 20), “EMA-20”, colorBlue, styleLine|styleThick|styleNoRescale);
    //Plot(EMA(C, 50), “EMA-50”, colorBlack, styleLine|styleThick|styleNoRescale);

    pp = (H + L + C)/3;
    //Plot(EMA(Ref(pp, -1), 3), “EMA pp”, colorWhite, styleLine|styleNoRescale);

    red = green = 0;
    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|styleNoRescale);
    Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen, styleLine|styleNoRescale);
    red = IIf(resbase == base, 1, 0);
    green = IIf(supbase == base, 1, 0);
    }

    r1[1] = 0;
    s1[1] = 0;
    for (i = 1; i <= numline; i++)
    {
    resbase = LastValue(Peak(base, percent, i));
    supbase = LastValue(Trough(base, percent, i));

    r = SelectedValue(ValueWhen(resbase==base, HHV(H, HHVperiod)));
    s = SelectedValue(ValueWhen(supbase==base, LLV(L, HHVperiod)));

    r1[i] = r;
    r1[i+numline] = s;
    //r1[i] = SelectedValue(ValueWhen(resbase==base, HHV(H, HHVperiod)));
    //s1[i] = SelectedValue(ValueWhen(supbase==base, LLV(L, HHVperiod)));
    }

    r1 = sort(r1);
    "R1-1: " + WriteVal(r1[1], 1.2);
    "R1-2: " + WriteVal(r1[2], 1.2);
    "R1-3: " + WriteVal(r1[3], 1.2);

    // find nearest three resistance lines (values above current high)
    near_r1[1] = 0;
    j = 1;
    for (i = 1; i SelectedValue(H))
    {
    near_r1[j] = r1[i];
    j = j + 1;
    }
    }

    “Linregslope of Close: ” + WriteVal(LinRegSlope(C, 3), 1.2);

    Current High: ” + WriteVal(H, 1.2);

    Nearest Resistance Levels:
    “;
    “R1: ” + WriteVal(near_r1[1], 1.2);
    “R2: ” + WriteVal(near_r1[2], 1.2);

    // find nearest three nearest support lines (values below current low)
    near_s1[1] = 0;
    j = 1;
    for(i=numline*2; i >= 1; i–)
    {
    if (r1[i] 0)
    {
    near_s1[j] = r1[i];
    j++;
    }
    }


    Current Low: ” + WriteVal(L, 1.2);

    Nearest Support Levels:
    “;
    “S1: ” + WriteVal(near_s1[1], 1.2);
    “S2: ” + WriteVal(near_s1[2], 1.2);

    // Test
    /*
    resbase = LastValue(Peak(base, percent, 1));
    supbase = LastValue(Trough(base, percent, 1));
    sup1 = ValueWhen(supbase==base, LLV(L, HHVperiod));
    res1 = ValueWhen(resbase==base, HHV(H, HHVperiod));
    “Resbase: ” + WriteVal(resbase, 1.2);
    “SUpbase: ” + WriteVal(supbase, 1.2);
    “Supp1: ” + WriteVal(sup1, 1.2);
    “Res1: ” + WriteVal(res1, 1.2);

    resbase = LastValue(Peak(base, percent, 2));
    supbase = LastValue(Trough(base, percent, 2));
    sup1 = ValueWhen(supbase==base, LLV(L, HHVperiod));
    res1 = ValueWhen(resbase==base, HHV(H, HHVperiod));

    “;
    “Resbase2: ” + WriteVal(resbase, 1.2);
    “SUpbase2: ” + WriteVal(supbase, 1.2);
    “Supp2: ” + WriteVal(sup1, 1.2);
    “Res2: ” + WriteVal(res1, 1.2);

    resbase = LastValue(Peak(base, percent, 3));
    supbase = LastValue(Trough(base, percent, 3));
    sup1 = ValueWhen(supbase==base, LLV(L, HHVperiod));
    res1 = ValueWhen(resbase==base, HHV(H, HHVperiod));

    “;
    “Resbase3: ” + WriteVal(resbase, 1.2);
    “SUpbase3: ” + WriteVal(supbase, 1.2);
    “Supp3: ” + WriteVal(sup1, 1.2);
    “Res3: ” + WriteVal(res1, 1.2);

    // End test

    “;
    “Base: ” + WriteVal(base, 1.2);
    WriteIf(red, “Resistance”, “”);
    WriteIf(green, “Support”, “”);

    “;

    */

    “;
    Title = Name() + “; ” + Date() + “: Support & Resistance Levels using RSI: ” + EncodeColor(colorGreen)+ “Support Levels are Green; “+EncodeColor(colorRed)+ “Resistance Levels are Red: “+EncodeColor(colorBlack)+”Number of lines of each =”+WriteVal(numline,1) +
    EncodeColor(colorRed) + ”
    EMA-10: ” + WriteVal(EMA(C, 10), 1.2) +
    EncodeColor(colorBlue) + ”
    EMA-20: ” + WriteVal(EMA(C, 20), 1.2) +
    EncodeColor(colorBlack) + ”
    EMA-50: ” + WriteVal(EMA(C, 50), 1.2) ;

    SetChartBkGradientFill( ParamColor(“BgTop”, colorTeal),ParamColor(“BgBottom”, colorLightGrey));

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

    Hh = HHV(C,1) ;
    Ll = LLV(C,1) ;

    Hh = Ref(HHV(C,1),-1) ;
    Ll = Ref(LLV(C,1),-1);

    //Plot(Hh,”1 Bar High”,colorGreen,styleLine);
    //Plot(Ll,”1 Bar Low”,colorRed,styleLine);

    Plot(Close,”Close”,
    IIf(C > Hh, colorBrightGreen,
    IIf(C Hh;
    Sell = C < Ll;

    Buy = ExRem( Buy, Sell );
    Sell = ExRem( Sell, Buy );

    PlotShapes(shapeUpTriangle* Buy, colorGreen, 0, L );
    PlotShapes(shapeDownTriangle* Sell, colorRed, 0, H );
    "Jeevan's Advice: "+WriteVal(0);
    "Bullish if Closing Above : "+WriteVal(Hh,1.01);
    "Bearish if Closing Below: "+WriteVal(Ll,1.01);
    "Current Close : "+WriteVal(Close,1.0);

    _SECTION_END();

  4. hi ankit ,
    Thanks for your response .Rectified code given by you is giving syntex error in ami 5.30 .

  5. yah jitin
    i checked rajandran sir is right while pasting here some codes are getting missed in “boxsize” variable so i have uploaded all 6 modified point n figures in afl plus one xls point n figure and they all work fine here on my 5.30 amibroker

    http://www.4shared.com/file/2FSFWi8f/point_and_figure.html

    along with that u can read following books

    Definitive guide to point and figure charting – Jeremy Du Plessis
    Point and Figure Charting – Thomas J Dorsey

    if any problem due ask

    @rajandran je
    plz sir if u have spare time due luk at my problem sir also posted here on 19-11-2010

  6. HI RAJ SIR ,
    On dowloading this afl it opens in some unreadable language plz ck @ your end Download The Foundation by Southwind v-13.00 Int AFL Code tx

Leave a Reply

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