Menu
  • Option Hydra
  • Training
  • Premium
  • Courses
  • Library

Marketcalls

Simply Intelligent Technical Analysis and Trading Strategies

  • Software
    • Amibroker
    • NinjaTrader 7
    • Ninjatrader 8
    • Option Action
    • Market Analyst
    • Metatrader
    • Python
    • Datafeed
  • Market Profile
    • Orderflow
  • Markets
  • Commodities
  • Forex
  • Economy
    • Banking
  • Webinars
  • Trading Lessons
    • Algo Trading
    • Infographic
    • Video
You are here: Home / Amibroker / Larry Connors RSI Amibroker AFL code

Larry Connors RSI Amibroker AFL code

February 9, 2013 by Rajandran 16 Comments

What is Connors RSI?

Connors RSI is a composite indicator consist of 3 components:

1. Price Momentum: By default, ConnorsRSI uses a standard 3 period Wilder RSI for the 1st component.

2. Duration of Up Trend vs. Down Trend streak days. And applies a default 2 day Wilder RSI to this integer series.Connors research shows that the longer the number of consecutive days up or down, the more likely the security is likely to bounce when it reverts to the mean. Likewise, the *magnitude* of the mean reversion snap-back is correlated with the streak length. The 2nd indicator uses integer values to quantify the number of streak days, and applies a default 2 day Wilder RSI to this integer series.

3. Relative Magnitude of Price Change: This 3rd component uses the PercentRank function over a default value of 100 days (approx. 5 months) to measure price change as a percentage of the previous day’s price, and rank the current value over the lookback period. Large positive returns will have a rank closer to 100, large negative returns will have a percent rank closer to 0.

Connors RSI Amibroker AFL

 
Connors RSI Formula

ConnorsRSI(3,2,100) = [RSI(Close,3) + RSI(Streak,2) + PercentRank(100)] / 3

Connor’s Research purports this robust indicator is more effective than any of the three components use individually, and in fact the blended effect of the mathematical summation allows the strong value from one indicator to compensate for a slightly weaker value from another, in a way yielding superior results than a voting system between the 3.

//Connor's RSI (Larry Connors).  Code for function provided by Connors Research

paramLenRSI = Param("RSI Closes Length", 3, 2, 100, 1);
paramLenUD = Param("RSI UpClose Length", 2, 2, 100, 1);
paramLenRank = Param("PerecentRank Length", 100, 10, 200, 1);

function ConnorsRSI(lenRSI, lenUD, lenROC)
{
      upDays = BarsSince(C <= Ref(C,-1));
      downDays = BarsSince(C >= Ref(C,-1));
      updownDays = IIf(upDays > 0, upDays, IIf(downDays > 0, -downDays, 0));
      crsi = ( PercentRank(ROC(C,1), lenROC) + RSIa(updownDays,lenUD) +RSI(lenRSI))/3;
      return crsi;
}

Plot( ConnorsRSI(paramLenRSI,paramLenUD,paramLenRank)
      , "ConnorsRSI("+paramLenRSI+","+paramLenUD+","+paramLenRank+")"
      , colorBlue, styleLine, 0, 100);

Download the free Ebook about how to trade with Larry Connors RSI – Pullback strategy

Related Readings and Observations

  • Code Snippet : ORB – Open Range Breakout Levels – Amibroker AFL Code (Better Version)Code Snippet : ORB – Open Range Breakout Levels – Amibroker AFL Code (Better Version) Open Range Breakout is a simple strategy which monitors first 5min / 15min / 15min / 30min / 60min range from the start of the market. From the opening high range and low range is […]
  • PercentRank Based Smooth ATR to Predict Change in Volatility – Amibroker AFL CodePercentRank Based Smooth ATR to Predict Change in Volatility – Amibroker AFL Code Is there a way where one can identify market regime shift from low volatility zone to high volatility zone and vice versa? How I can identify stocks with increasing volatility? Is there a […]
  • How to Get Moneycontrol News Snippets into Amiboker?How to Get Moneycontrol News Snippets into Amiboker? Getting the newsfeed directly into my favorite charting software is always been interesting to me. If you are a news-hungry trader/investor possibly you may be also thinking in the same […]
  • Code Snippet : Price with Last Trade Price Marker : AmibrokerCode Snippet : Price with Last Trade Price Marker : Amibroker Here is a simple Amibroker AFL code snippet which tracks the last trade price with a dashed horizontal line at LTP. It could be useful for the people who wants to know where the current […]
  • Trading the Previous Day High and Previous Day Low Breakout – Do Simple Strategies Really Work? [Part1]Trading the Previous Day High and Previous Day Low Breakout – Do Simple Strategies Really Work? [Part1] Do simple strategies really work in Indian Markets? This curiosity arises when one of our Amibroker Mumbai Participant comes up with a simple trading strategy. Hence the tutorial series, […]
  • Absolute Monthly and Yearly   Profit/Loss Table – Amibroker AFL CodeAbsolute Monthly and Yearly Profit/Loss Table – Amibroker AFL Code while back-testing by default Amibroker provides Profit Table in Compounded percentage terms. However the profit table can be customized according to ones requirement. Rather than doing a […]

Filed Under: Amibroker Tagged With: AFL Code, Amibroker, Connors RSI, Connors RSI Formula

About Rajandran

Rajandran is a Full time trader and founder of Marketcalls & Co-Founder of Traderscafe, trades mostly using discretionary Trading Concepts like Market Profile, Trading sentimental analysis, building timing models, algorithmic trading models. Instructs professional traders, full time traders & aspiring full time traders. Rajandran attended college in the Chennai where he earned a BE in Electronics and Communications. Rajandran has a broad understanding of trading softwares like Amibroker, Ninjatrader, Esignal, Metastock, Motivewave, Market Analyst(Optuma),Metatrader,Tradingivew,Python and understands individual needs of traders and investors utilizing a wide range of methodologies.

Comments

  1. Meena says

    February 9, 2013 at 10:09 am

    It’s giving Syntax error on line 11 & 13.
    Pls help sir.

    Reply
    • Rajandran R says

      February 13, 2013 at 11:41 am

      Which Amibroker Version you are using?

      Reply
      • Meena says

        February 14, 2013 at 10:34 am

        Sir . it’s 5.3
        Had read in TJ that some function ( percentrank or so) is absent in 5.3 and the member posted solution.
        But since i am newbie,will be kind of u if u can gimme some simple solution.
        thanks

        Reply
  2. Ashish says

    February 12, 2013 at 6:27 pm

    It gives following error.

    Line 12, Col: 27; Error 30: Syntex error
    Line 14, Col: 18; Error 29: Variable ‘crsi’ used without having initialized

    PLease help..

    Reply
    • Rajandran R says

      February 13, 2013 at 11:43 am

      You can initialize. Add the following code in the 8th line. However it is not mandatory here
      crsi =0;

      Reply
      • Mahender says

        February 20, 2013 at 4:03 pm

        Hi Rajandran,

        I’m using 5.30.4

        yes that is optional, crsi=0;
        In spite of adding it also, I’ve same issue.

        Once I remove “PercentRank(ROC(C,1), lenROC)”, No more issue.
        What is going wrong with it?

        Please share your thoughts and help us.

        Thanks
        Mahender

        Reply
        • Rajandran R says

          February 20, 2013 at 4:37 pm

          @Mahendar,

          Percentile rank function does works with Amibroker 5.3 and lower versions.

          Reply
  3. Mahir Shah says

    March 7, 2013 at 5:13 pm

    Hi Rajandran,
    I have seen your supertrend indicator for metasock, I was wondering if you can/ have coded Connors RSI for metastock. Any help will be highly appreciated.
    Regards
    Mahesh

    Reply
  4. Chandrakant says

    April 12, 2013 at 10:24 pm

    Dear Mr. Rajandran,

    Please guide us how we can add explore code for connorsRSI for stock selection.

    Your help will highly appreciated.

    Regards,
    Chandrakant

    Reply
  5. abhay says

    April 15, 2013 at 3:40 pm

    Dear Rajandran ,
    Is there any source from where i can get MCX-SX Currency EOD data in metastock form .

    Thanks & Regards
    Abhay Mehrotra

    Reply
  6. anil says

    April 27, 2013 at 6:47 pm

    pls correct this afl
    _SECTION_BEGIN(“sell buy”);

    SetChartOptions(1,chartShowArrows|chartShowDates|chartWrapTitle);
    Title = EncodeColor(colorYellow)+ Name() + ” -- ” + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorSkyblue) +
    ” -- ” + Date() +” -- “+”
    ” +EncodeColor(colorYellow) +”Open-“+O+” “+”High-“+H+” “+”Low-“+L+” “+”Close-“+C+” “+ “Volume= “+ WriteVal(V);

    //SetBarsRequired(100000,0);
    GraphXSpace = 15;
    EntrySignal = F1();
    ExitSignal = F2();
    Color = IIf( EntrySignal, colorBlue, IIf( ExitSignal, colorRed, colorGrey50 ));
    Plot( C, “Price”, Color, styleBar | styleThick );

    SetChartBkColor(ParamColor(“Outer panel color “,colorLightYellow));
    SetChartBkColor(ParamColor(“BackGround Color”, colorDarkGrey));
    messageboard =ParamToggle(“Message Board”,”Show|Hide”,1);
    target = Optimize(“Target”,Param(“Target (Change To Optimise)”,10,0.05,1000,0.05),0.05,1000,0.05);
    AutoTarget = ParamToggle(“Auto Target Mode”, “Yes|No”,1);
    AudioAlert = ParamToggle(“Human Voice Alert”, “No|Yes”);
    EmailAlert = ParamToggle(“E-mail Alert”, “No|Yes”);
    AlertOutput = ParamToggle(“Alert Output”, “No|Yes”);
    starttime=Param(“Market Start Time”,091500,000000,235959,1 );
    endtime=Param(“Market End Time”,152500,000000,235959,1 );
    BackTestMode = ParamToggle(“Use Back Tester Settings”, “Yes|No”);
    Param_Margin = Param(“Margin required (used for backtesting only)”, 15,0.001,100,0.001);
    Param_LotSize = Param(“Lot Size (used for backtesting only)”, 50,1,50000,1);
    Param_NoOfLots = Param(“No of lots normally traded (used for backtesting only)”,1,1,10000,1);
    ConstantLot = ParamToggle(“Trade Constant Lot”, “No|Yes”);

    C13=20;
    C14=2.1;
    C15=12;
    Miny = Status(“axisminy”);
    Maxy = Status(“axismaxy”);
    lvb = Status(“lastvisiblebar”);
    fvb = Status(“firstvisiblebar”);
    pxwidth = Status(“pxwidth”);
    pxheight = Status(“pxheight”);

    #include_once “SS_include.afl”

    bars = LastValue( IIf(BarsSincebuy endtime AND NOT Relax)==1) Say(“Exit position in “+Name()+” at current market price “+C);
    if (SelectedValue(bookshort AND NOT Short AND NOT Relax)==1) Say(“Target achieved in short in “+Name()+” at “+tar);
    if (SelectedValue(booklong AND NOT Buy AND NOT Relax)==1) Say(“Target achieved in long in “+Name()+” at “+tar);
    }

    if (EmailAlert==True)
    {
    AlertIf( Buy, “EMAIL”, “Long signal generated on “+FullName(), 1 );
    AlertIf( booklong AND NOT Buy AND NOT Relax, “EMAIL”, “Target achieved in long in “+FullName(), 1 );
    AlertIf( Short, “EMAIL”, “Short signal generated on “+FullName(), 1 );
    AlertIf( bookshort AND NOT Short AND NOT Relax, “EMAIL”, “Target achieved in long in “+FullName(), 1 );
    AlertIf( TimeNum() > endtime AND NOT Relax, “EMAIL”, “Exit position in “+FullName(), 1 );
    }

    if (AlertOutput==True) {
    AlertIf( Buy, “”, “Buy Signal Generated”+Name(), 4 );
    AlertIf( booklong AND NOT Buy AND NOT Relax, “”, “Target achieved in long in “+Name(), 4 );
    AlertIf( Short, “”, “Short Signal Generated”+Name(), 4 );
    AlertIf( bookshort AND NOT Short AND NOT Relax, “”, “Target achieved in short in “+Name(), 4 );
    AlertIf( TimeNum() > endtime AND NOT Relax, “”, “Exit position in “+Name(), 4 );
    }

    if
    (messageboard == 1 )
    {

    GfxSelectFont( “Tahoma”, 13, 100 );

    GfxSetBkMode( 1 );

    GfxSetTextColor
    ( colorWhite );

    if ( SelectedValue( LastSignal ) == 1 )
    {
    GfxSelectSolidBrush( colorDarkBlue );
    }
    else
    {
    GfxSelectSolidBrush( colorDarkRed );
    }

    pxHeight = Status( “pxchartheight” ) ;

    xx = Status( “pxchartwidth”);

    Left = 1100;

    width = 310;

    x = 5;

    x2 = 290;

    y = pxHeight;

    GfxSelectPen
    ( colorLightBlue, 1); // border color

    GfxRoundRect
    ( x, y -- 90, x2, y , 7, 7 ) ;

    GfxTextOut
    ( (“For Enquiry: buy sell”),13,y-85);

    GfxTextOut
    ( (“” + WriteIf(Buy, “Go Long At “+C+” -- SL ” +sl,””)), 13, y-65);

    GfxTextOut
    ( (“” + WriteIf (Short, “Go Short At “+C+” -- SL ” +sl,””)), 13, y-65);

    GfxTextOut
    ( (“” + WriteIf (TimeNum() > endtime AND NOT Relax, “Exit Position At “+C,””)), 13, y-65);

    GfxTextOut
    ( (“” + WriteIf (Long AND NOT Buy, “Long At “+BuyPrice+” -- SL ” + sl + “”,””)), 13, y-65);

    GfxTextOut
    ( (“” + WriteIf (shrt AND NOT Short, “Short At “+ShortPrice+” -- SL ” + sl + “”,””)), 13, y-65);

    GfxTextOut
    ( (“” + WriteIf (Relax, “Not In Trade -- RELAX!!!”,””)), 13, y-65);

    GfxTextOut
    ( (“” + WriteIf (shrt AND NOT Short, “Current P/L: “+(ShortPrice-C)+” Points”,””)), 13, y-45);

    GfxTextOut
    ( (“” + WriteIf (Long AND NOT Buy, “Current P/L: “+(C-BuyPrice)+” Points”,””)), 13, y-45);

    GfxTextOut
    ( (“” + WriteIf (bookshort AND NOT Short AND NOT Relax, “Profit Booked: “+(ShortPrice-tar)+” Points”,””)), 13, y-45);

    GfxTextOut
    ( (“” + WriteIf (booklong AND NOT Buy AND NOT Relax, “Profit Booked: “+(tar-BuyPrice)+” Points”,””)), 13, y-45);

    GfxTextOut
    ( (“” + WriteIf (Long OR Buy OR Shrt OR Short, “Target: “+tar,””)), 13, y-25);

    GfxTextOut
    ( (“” + WriteIf (booklong AND NOT Buy AND NOT Relax, “Target Done: “+tar,””)), 13, y-25);

    GfxTextOut
    ( (“” + WriteIf (bookshort AND NOT Short AND NOT Relax, “Target Done: “+tar,””)), 13, y-25);
    }

    GfxSetBkMode( 1 );
    GfxSelectFont(“Tahoma”, Status(“pxheight”)/C13);
    GfxSetTextAlign( 6 );
    GfxSetTextColor( ColorRGB (217,217,213));
    GfxTextOut( “buy sell”, Status(“pxwidth”)/C14, Status(“pxheight”)/C15 );
    GfxSelectFont(“Tahoma”, Status(“pxheight”)/C13*0.5 );
    GfxSetTextColor( ColorRGB (103,103,103));
    GfxTextOut( “By”, Status(“pxwidth”)/C14, Status(“pxheight”)/C15*2.5 );
    GfxSelectFont(“Tahoma”, Status(“pxheight”)/C13*0.5 );
    GfxSetTextColor( ColorRGB (103,103,103));
    GfxTextOut( “buy sell”, Status(“pxwidth”)/C14, Status(“pxheight”)/C15*4 );
    GfxSelectFont(“MS Sans Serif”, 10, 500, False, False, 0);

    PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25);
    PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35);
    PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
    PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25);
    PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35);
    PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);

    PlotShapes(IIf(TimeNum() > endtime AND Long, shapeHollowStar, shapeNone),colorGold, 0,H, Offset=15);
    PlotShapes(IIf(TimeNum() > endtime AND Shrt, shapeHollowStar, shapeNone),colorGold, 0,L, Offset=-15);

    PlotShapes(IIf(Sell AND NOT Short, shapeStar, shapeNone),colorRed, 0, H, Offset=15);
    PlotShapes(IIf(Cover AND NOT Buy, shapeStar, shapeNone),colorBlue, 0,L, Offset=-15);

    PlotShapes(IIf(booklong AND NOT Buy AND NOT Relax, shapeStar, shapeNone),colorRed, 0, H, Offset=15);
    PlotShapes(IIf(bookshort AND NOT Short AND NOT Relax, shapeStar, shapeNone),colorBlue, 0,L, Offset=-15);

    //Settings for Backtester
    if (BackTestMode==True)
    {
    SetOption(“AllowSameBarExit”, False);
    SetOption(“AllowPositionShrinking”, False);
    SetOption(“FuturesMode”, True);
    SetOption(“InterestRate”,0);
    SetOption(“MaxOpenPositions”,1);
    RoundLotSize = Param_LotSize;
    SetOption(“MinShares”,RoundLotSize);
    SetOption(“PriceBoundChecking”,False);
    //SetOption(“CommissionMode”,3);
    //SetOption(“CommissionAmount”,12.5/RoundLotSize);

    SetOption(“AccountMargin”,Param_Margin);
    SetOption(“ReverseSignalForcesExit”,True);
    SetOption(“UsePrevBarEquityForPosSizing”,True);
    ApplyStop(stopTypeTrailing, stopModePoint, TSL, True, True );

    if (ConstantLot==True)
    {
    PositionSize = C*RoundLotSize*Param_NoOfLots;
    }
    SetTradeDelays(0,0,0,0);
    BuyPrice = Close;
    SellPrice = Close;
    ShortPrice = Close;
    CoverPrice = Close;
    }
    _SECTION_END();

    Reply
  7. Surez says

    May 3, 2013 at 7:25 pm

    Rajandren Sir, Did u correct Mr.Anil’s request ?
    it showing error in #include_once “SS_include.afl”
    Do we need SS_include.afl indicator ?
    Pls guide me

    Reply
  8. shabber merchant says

    October 2, 2013 at 11:58 pm

    hello
    i would like to know the above mentioned connors rsi work with esignal or it has to modified ,if so pls modify it , it will be helpfull.
    thanks.

    Reply
  9. senthil says

    May 13, 2014 at 3:27 pm

    hello sir i am using MT4 demo softwar i want mcx commodity live chat for lowest cost pls help me sir

    Reply
  10. Thomas Musselman says

    March 12, 2015 at 9:12 pm

    Have you seen or do you know how to code connorsrsi for Excel?
    -T.M. in Scottsdale

    Reply
  11. James Tucker says

    July 16, 2015 at 1:39 am

    I too would love to have a copy of Connorsrsi for Excel, if anyone has it…
    Thank you
    JWT

    Reply

Leave a Reply to Mahir Shah Cancel reply

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

Email Newsletter

Sign up to receive email updates on latest trading strategies , analysis & financial market updates

We Respect Your Privacy

Premium Access

Username:
Password:
Remember Me
Lost your password?

Tools For Traders

  • Marketcalls Android App
  • MCX Signals
  • Intraday Signals
  • International Commodities
  • OI Tracker
  • Participation OI
  • Your Broker
  • Market Sentiment Analysis

Amibroker Updates

Volatile Phases – Colorful ADX Amibroker AFL Code

November 16, 2019 By Rajandran 4 Comments

Amibroker Technical Analysis Workshop – Bangalore

November 1, 2019 By Rajandran 2 Comments

How to Send Alerts from Amibroker to Telegram Channel using Telgram API

June 12, 2019 By Rajandran 15 Comments

How to Estimate the VWAP based settlement Close like a Pro using Amibroker?

June 9, 2019 By Rajandran Leave a Comment

Practical Approach to Amibroker AFL Coding

May 23, 2019 By Rajandran 37 Comments

  • Facebook
  • Google+
  • LinkedIn
  • RSS
  • Twitter
  • YouTube

Metatrader Updates

MetaTrader 5 Demo Servers Now Available for BSE Currency Markets

March 20, 2018 By Rajandran 8 Comments

ChartIQ – WebTrader for MT4

December 4, 2017 By Rajandran 5 Comments

Metatrader 4 – Web Platform Overview

October 29, 2015 By Rajandran 9 Comments

William VIX FIX Indicator for Metatrader 4

May 16, 2015 By Rajandran 9 Comments

How to Install Custom MQL4 indicators in Metatrader

November 14, 2014 By Rajandran 7 Comments


About | Contact Us | Terms and Conditions | Privacy Policy | Support Policy | Privacy Policy | Refund Policy | Disclaimer


© Copyright 2018 Marketcalls Financial Services Pvt Ltd · All Rights Reserved · And Our Sitemap · All Logos & Trademark Belongs To Their Respective Owners·

Data and information is provided for informational purposes only, and is not intended for trading purposes. Neither marketcalls.in website nor any of its promoters shall be liable for any errors or delays in the content, or for any actions taken in reliance thereon.