10 things to know about Supertrend v2.0 AFL code

Supertrend Sound and popup Alerts

This time comingup with upgraded version of Supertrend indicator with sound and popup alerts. Here are instructions for those who follows Supertrend v2.0 to trade in a better manner. Installation steps are listed below.

10 things you need to know about Supertrend

1)Supertrend is a carry forward strategy which involves overnight gapup/gapdown risk and also weekend carry forward risk. It is not a pure intraday strategy.
2)Supertrend normally makes more profit when the volatility increases and makes lesser losses when the market shows compressed volatility.
3)Most of the profits are made in gap up and gap down openings compared to the losses made in gapup/gapdown
4)Should works good with High Beta Stocks and BankNifty
5)Supertrend has two input factors Multiplier and ATR. default value is 3 and 7. Increasing the multiplier will increase the risk and decrease the profits. (Tested across all the timeframes). And lower multiplier values will results in more number of trades which means more commissions and more slippages.to pay.
6)Always start your trade when the past trades which you hadnt participated shows the worst. Don’t start once you seen the best best part of profits in Supertrend indicator. As the winning ratio is 42% it is not advisable to start your trade once you see the best results of any indicator. Wait for three or more consecutive losses to occur on the charts to start your trade after consecutive losses and not after consecutive winning on the charts.
7)Winning ratio is more or less between 42-45% across all the timeframes. (doesn’t includes brokerages and slippages). However most of the times higher time frame involves high risk in trading supertrend indicator.
8)Now the strategy supports Sound and Popup Alerts whenever there is a buy or sell signal in place. Time bar left functionality has been removed as alerts and non repainting features overrides the Timebar left functionality.
9)Supertrend V2.0 Strategy work only with amibroker version 5.4 and higher.
10)It is advisable to trade one or two symbols at a time. Avoid jumping from one stock to another which could sometimes lead to consecutive losses and even missing most profitable signals.

How to Install the Supertrend Indicator
1)Download Download Supertrend AFL code with Sound and Popup Alerts
2)Unzip Supertrend V2 to local folder
3)Copy Non Supertrend AFL code ver2.afl code to c:program filesamibrokerformulasbasic folder
4)Copy popup.afl to to c:program filesamibrokerformulasInclude folder
5)Open Amibroker and Open a New Blank Chart
6)Goto Charts->Basic Charts and apply/drag-and-drop the Non Supertrend AFL code ver2.afl code into the blank chart
7)Bingo you are done. Now you will be able to see the Supertrend indicator with Buy and Sell signals.

For watching Supertrend live visit your NSE live trading signals section. Commodity lovers can watch MCX trading signals here.If you have more concerns and feedback about trading this indicator comment below to get clarified.

Related Readings and Observations

  • Things You Need to Know About VWAP In finance terms, volume-weighted average price (VWAP) is defined as the ratio of the value traded to total volume traded over a particular time horizon (usually one day). It is a measure […]
  • Rotation Factor – Amibroker AFL Code Rotation Factor is a sentimental indicator used in Market Profile to Indicate who is control (Buyers/Sellers) in the market for the day. If the rotational factor prints positive values […]
  • Full Gap Open Range Strategy – Amibroker AFL Code Here is a simple Full Gap Open Range Strategy for intraday traders to trade the big gap ups and gap downs using open range breakout. And more important strategy is back-testable.
  • How to Compute Cointegration using Amibroker and Python Cointegration is used in Statistical Arbitrage to find best Pair of Stocks (Pair Trading) to go long in one stock and short(Competitive peers) another to generate returns. Statistical […]


  1. tharun says

    Hello sir,
    I’m using amibroker with global datafeed, i want purely intraday AFL code, so i want to trade in futures segment only. I want to do automated trading so please provide me AFL code.
    Thank You.

  2. Ratnadip Roy says

    Hello Sir,

    I have just installed supertrend v2 afl code. I use datafeeder for real time data but it provides only nse/bse data. Kindly provide some afl code which provides both nse (cash & fno) and mcx real time data at a free of cost.

    Thank you very much for your wonderful gifts that you keep providing since 2007.

  3. OSK says

    Dear Rajandran,

    Your efforts deserve many applauds. Yesterday I tried inserting Alertif functions and finally succeeded in getting email as well as other kind of alerts. I think this would help many from trading emotionally. Based on my experience, major amount of money is lost due to anxiety. Anyway now you have included pop-up alert. Surely it will be of great help to trading community.

    Keep it up.

  4. Parthasarathy says

    Dear Rajendran,
    Will this supertrend back tested to use in MCX base metals like Lead,Zinc etc.?Already I am having Amibroker with RTDS and with your input I feel I can load this supertrend with popup.


    • says

      @Parthasarathy : It works good with any high volatile instruements. For MCX market is better to use 10min or 15min timeframe due to the extended nature of the market timings.

  5. Raj Sharma says

    Thanks for your great efforts. Supertrend works great for NIFTY Futures. I had a question.
    1. Can I use the Supertrend on NIFTY options also ?
    2. Can I follow the same rules and carry forward in case of Options also ?
    3. Or I can square off position till the end of the day.
    Please guide us.

    • says

      Raj Sharma,

      It is advisable to backtest withs sufficient backfill information. Atleast 2-3 years of backtesting data is required. Since i dont have valid backtesting data for nifty options i cant comment on using supertrend in Nifty options. Yes supertrend is a carry forward strategy. For intraday you need to conver supertrend strategy to exit intraday and have to backtest accordingly.

  6. Parthasarathy says

    Dear Rajendran,
    I got it and installed the supertrend with popup and will test it at 10/15min in the MCX base metals..Thanks for your guidance.

  7. Prateek gupta says

    Can you pls Share MCX IEOD data. As i am using Manshi RT and I have 2 months back fill. I need Atleast 6 months to 1 yr IEOD MCX data for

  8. Durgesh says

    Dear Rajandran,

    I need Stock Option intraday tick data (1 min is also sufficient). Can you help me that which is the cheap and best data provider. Like Reliance 1000 CE / infosys 2900 CE


  9. chandan says

    It’s a great effort you have put in. Recently I have added the file as per your instruction. when I am trying to do backtest, I got error on below line
    GfxTextOut( (“Current P/L : ” + WriteVal(IIf(sig == “BUY”,(C-entry),(entry-C)),2.2)), 13, y-22);;
    Error is “variable entry used without having been initialized”. Please tell me if I am doing something wrong.
    Also I have some queries,

    1- I prefer doing delivery base trading for max 3-4 days. Please tell if this is helpful to identify my pick or if you can suggest some other code.
    2- By using Supertrend, How I can get the buy/sell signal generated for today EOD.
    3- At last please tell me the use of popup and how I can use it. I have added the file as mentioned in include folder but don’t know the effect it’s going to make.

    I know it’s a long list but I will be thankful if you can guide me

  10. tharun says

    Hi Sir,
    I have downloaded Non-repainting supertrend indicator and trend magic from your site in this which is best for intraday for stock futures.
    please tell me.

  11. swapna says

    thnk u very much for giving this afl. i installed afl what u say. but i dont get message box and time left. i use ami 5.4

  12. arvind says

    Dear Rajandran, i can do little programming in Amibroker. want to put a scan filter where two lines cross at an angle specified or greater than that. in case of curves maybe their tangents can be taken for angles they make. is there any command for this or any AFL already using this filter. please guide i shall remain thankful. Thanks Regards Arvind Gupta

  13. VIKASHH says

    sir as i have asked earlier alsp like rsi corner formula is in html format how to convert or how to paste it in formula file pls guide

  14. Sridhar V says

    I have started using Supertrend as a basic guide to Nifty direction & do the corresponding trades in Options (buy side calls or puts). Look at both 5 min & 15 min to take positions & exit. Would like something for a positional trading in Options? Any suggestions?

  15. Parthasarathy says

    Dear Mr.Rajendran,
    Trying the supertrend with Pop up in Base metals of MCX with 15 mts time period.My obeservations are it is good during the high volatile phase than the flat periods (which mostly exists around 11 hours) trading.Kindly let me have your suggestion.

    • says

      @Parthasarathy : This indicator doesnt predicts the future rather it gives you less losses and more profits with a good risk reward ratio. And the risk reward ratio is higher in highly volatile environments.

  16. p.kailash says

    sir if trade according to super trend in crude in 5mts tf and follow all the buy sell entry for one month how will loss occur sir bcaz iam in the same trend accoding to super trend and sir iam in prepaid brokerage plan ie 3000/month so nothing to worry for brokerage pl sir let me know how will loss occur buy 1lot sell 2lots buy 2lots……. ……..pl waiting for your experenced knowledeg

    • Parthasarathy says

      No technic can predict the future cource. Supertrend provides some lead to buy/sell thro’ pop’s @ of 40 to 50% sucesses .Regarding edging by buying in current and sell at the second may only balance the position but coming out from the trade only decide the profit or loss.

  17. Malleswara Rao BVVN says

    dear rajendran, you are suggesting ‘always trade with two lots. book one lot at target lines’. If i booked one lot at first target. where should i book the second lot? at 2nd target or at exit point?

  18. Malleswara Rao BVVN says

    Thank you. Then booking a loss in a losing trade with two lots & booking one lot @ 1st target in a wining trade, is it worthwhile?

    • says

      In case of Gap Up or Gap down or days with heavily bullish/bearish new one can use the second or third lines as target lines to book partial profits there.

  19. Satheeshmukundan says

    The popup with sound is very useful . But it works for the stocks with charts on the screen . Is there any way to get the popup with sound for all scrips in the amibroker database when ever a buying/selling opportunity occurs…. pl give the afl code for this….

  20. p.kailash says

    sir in super trend which parameter and timeframe is good for silver crude banknifty nifty and nifty option pl kindly suggest me sir

  21. Samir Shah says

    Please clear the error bellow

    GfxTextOut( (“Current P/L : ” + WriteVal(IIf(sig == “BUY”,(C-entry),(entry-C)),2.2)), 13, y-22);;

    Error is “variable entry used without having been initialized”.

  22. Manish Gupta says

    Hi Rajandran,

    Can u pl suggest the settings to be used for Supertrend afl for Nifty Future on 1/3/15/30/60/75 mins/Daily/Weekly time frames?

    • Manish Gupta says

      Hi Rajandran,

      Can u pl suggest the settings to be used for Supertrend afl for Nifty Future on 1/3/15/30/60/75 mins/Daily/Weekly time frames?

  23. HARSH says

    SIR I USE YOUR MT4 LEVEL STOP INDICATOR THAT IS WONDER FULL INDICATOR . I LIKE TO SHARE MY personel expirence i use mt4 level stop with setting 14,2.824and 14 with renko charts for mcx trading and this combination do wonderful job. less noise ,less false signals better moneymanagement
    your suggestion is required how to calculate exect box size of renko .

  24. raj patil says

    hi sir,
    my english is not parfect so i type in hindi
    sir me aapki marketwatch 5 minut chart (in commodity & equty) daily watch karta hu
    sir muje aapke chart softwear downlod karni ke liye kya karna padega
    plz replay

  25. Malleswara Rao BVVN says

    Dear Rajendran, In a 5 min chart, the signal frequently changes, is there any filter for reducing whipsaws?

  26. p.kail says

    can i trade with ATR 5 MULTIPLIER 1.8 insuper trend in nifty cal/put option pl give your suggestion or any other parameter

  27. Veer says

    Dear Mr.Rajendran

    Sometime back you have published regarding importing of ITM Financial Signal into GCI MT4 . Could you please give the link -- it will be helpful.



  28. Gajendra says

    Sir, i daily watch your web site since more than 3 years. plus you send the market day to day coverage in detail of trading information through email. i am confused how to go about with AMIBROKER’s that is minimum how many days BACKFILL is required .

  29. eraldo says

    I tried to install the file as points
    3) Copy not Supertrend AFL code ver2.afl code from C: Program folder filesamibrokerformulasbasic
    4) Copy to popup.afl in c: program folder filesamibrokerformulasInclude
    but I can not find filesamibrokerformulasbasic and filesamibrokerformulasbasic
    maybe I did not understand where to install

    • Milton B says

      eraldo, he left out the \ but it is C:\Program Files\AmiBroker\Formulas\Basic just copy files to folder, close then open AB then insert into a chart and you will see.

      I can’t get decent backtest results but the buy/sell arrows looks to occur in decent times. Will keep tweaking, thanks Rajandran

    • says

      It doesnt works in longer duration markets. Longer the duration of the market more complex your strategy should be to lock into profits. A simple Trend trading never works in 24x5 forex markets.

  30. Sherin Jose says

    Dear Sir, I’m a new comer on market and lost 5lac in a year. now i am looking to start trading with technical analysis software. please provide me your valueable informations about which and where i can get the best software.

    • says

      Sherin Jose,

      Your Losses and Profits doesn’t depend upon the trading software used. It depends upon the discipline and the logic used in your trading decisions. Software play only a minor role in providing edge in this market.

  31. kittu says

    Hi Rajendran,

    Can the supertrend indicator be used for trading USDINR on NSE? If yes what are the best parameters to get best results?

  32. Venu Gopal says

    Hi Rajendran,

    I am a trader and a customer of Unicon Securities where they use NEST application, so my question is can we connect NEST to Amibroker and trade from there. If yes then please consider this as a request and send me the procedure how we can link NEST to Amibroker please.


    Venu Gopal

  33. kiruba says

    Hi Raj,

    I have been using SuperTrend AFL with 12 Minutes time frame for a while, SuperTrend suits my trading style as there are less false signals when compared to EMA cross over type system and also trading in lesser time frame allows me to risk less. i.e 2% of my capital per trade.

    I have back tested Nifty 2008 to till date with Super Trend and returns are very good with 10/12 mins time frame. I have back tested with 5, 10, 12, 30 and 1 hour time frame. Out of all these 12 minutes provide good result with less no of trades.

    Without any discretionary interruption if we trade with discipline, in the long run am sure we would earn more returns using this system.

    here’s the back test result.

  34. Manish Gupta says

    Hi Kiruba,

    Can u pl confirm the settings of supertrend used in backtesting?.
    If suppose some one intend to use the supertrend on 1/3/5/15/30/60/75 mins/D/W/M time frames, what settings of supertrend are suitable to use? Also how we can fine tune this settings by checking them through backtesting.

  35. kalyan says

    hello sir the current value display of nifty or banknifty etc is going out side the right side of the ami window. any way very good one.

  36. p.kailash says

    thks for the link. pl let me know what is the parameter used for ATR MULTIPLIER in nifty. it will be very useful. thks

  37. Bhailalbhai says

    Dear Sir
    My friend told me this strategy. According to Supertrend, If daily is in BUY Mode, we should follow only buy signal in 5M TF and vice versa. Is this strategy more profitable compare to all Buy/Sell Signal on 5 M TF ? OR Any suggestion regarding this ??

    • kiruba says

      thats right. actual point is to trade with lower time frame based on what the higher time frame says. if 1 hour chart in buy mode and when 5 mins chart gives sell signal, just exit the long and do not go short untill 1 hour chart says so. bcoz soon u may get a reversal in 5 mins.

  38. BHAILALBHAI says

    Dear Sir

    I want to fine tune Supertrend indicator according to volatility So What would be the parameters, if Volatility is between 20 to 30, 30 to 40 and 40 to 50 ??

  39. bishnu prasad basyal says

    Dear Rajandran R,
    Thank you for helping by creating very useful AFL call Super trend V2. I have added this to my amibroker. It works with popup alerts but sound is missing. Can you help me get sound alert too.

  40. Rajendra Shrowty says

    Hi Rajandran,

    First & foremost, many thanks for all the wonderful work you are doing.

    I have installed Amibroker 5.60.3 and Stock Live Data Feeder 2.9.0 and now copied the Non Supertrend AFL code ver2.afl. I can see the Supertrend indicator with buy and sell signals. But there are a few things missing: 1) Amibroker shows 2-days old data -- for e.g. on 28th Nov’13, it was showing data only till 26th Nov’13. 2) After applying the Supertrend indicator, I am seeing 3 horizontal green/ red lines after the indicator has given the last buy/ sell signal -- what does that mean? 3) How to calculate stoploss using Supertrend?

    Thank you in anticipation,

  41. Anil says

    Rajendran, thnx for SuperTrend with Popup. just facing one problem , once the popup starts , doesn’t stops and hangs the Ami’s Parent screen. plz help to get rid of this problem.

  42. Mrityunjay says

    Hi Rajandran,

    This is great. Thanks for sharing. I had one question though.
    What all changes are needed to use this for longer duration’s? Is there a non intraday version for this.


  43. Anil says

    Thank you Rajendran for Supertrend with Popup. just facing one problem with popup, once it pops up, doesn’t stop and so the parent window hangs. Any Solution?

  44. Anu Nair says

    Hi Raja,
    I’m Nair from Indonesia. I am using MT4 for my trading. i can use this for my COMEX Gold ?

    Waiting for u r reply

  45. Preyank Bhanawat says

    Is it possible to modify this this afl in such a way that the color of the candle remains red in down trend and green in up trend

  46. Thiagu says

    Good day buddy,
    Am a long time viewer of ur website. very informative for retails traders…..really appreciate your help.

    Anyway, this afl here is ok, but the Popup that gives buy/sell signal shows only the last signal i mean, even if u move the Chart to the previous positions, the Signal should show wat was the signal during that position……i mean if it had given a sell signal during that LTP ( Chart location )..it sh ould show that but here, this always show the very last signal given……even if u scroll the chart back..only the Trail. SL and Current P/L calues cahnges…all other remain same…

    how to adjust this …………( Am not a technical person..so my terminology is of lay man’s. hope u udnersatnd…but slowly slowly but able to alter afl/parameters with ur isntructions…like the one u gave above for this afl…( for moving the LTP inside the panal view from extreme right ).
    SO u can advice wat to do …get this sorted out..i will do it myself…if its very difficult u can upload the edited popup afl.

    Thank you

  47. Thiagu says

    One more thing, have you heard of ” Cumulative Delta analysis ” ..what is discussed in TradersHelpDEsk.com …is it possible to make a afl for amibroker with that method ?

    And i hope u shud have heard of Delta Phenomenon……Is it possible to bring that into amibroker for signals…

    And buddy….plz understand….am a novice, so i dont have knowledge to experiment with coding….
    i know its easier said than done…..but it is just a query to get my views cleared from you.

    All the best for your Seminars..
    Tk cr

    • says

      Cumulative Delta analysis is order flow concept and current amibroker doesnt support it. You can try with softwares like ninjatrader,market delta or multicharts.

  48. Akhilesh says

    I was wondering if Super trend works anymore or if it is profitable any more. After the introduction of options at every 50 points instead of 100 points, I think the profitability of ST has decreased.

    Rajendran sir can you share the backtest results of ST from the Jan 2014 to present?


  49. srini says

    hi sir i need clarification on back testing these parameters, when i applied on our super trend, it shows different executed price but not actual price given on the arrow of buy and sell, not even on the close price.

    and also frequency of trade is quite different from actual

    How to set the right parameters in back test settings

    how to rectify it kindly help

  50. lucky says

    I install Supertrend V2 on ambi broker i have red and green thick line on downside no show and also stop loss not match with the your website

  51. Rahul says

    HI Rajandran R bhai,

    Thankyou very much for making supertrent ..

    When can we expect Super trent v3 and also it be excited to see profit in last 5 trades displayed..

    like it displays on site :)

    Keep up good work …. may God Bless you :)

  52. Sandip Patil says

    Hello Rajandran Sir,
    I want to ask you question regarding Super Trend Indicator as follows :
    (1) How exactly I should tread with Super Trend indicator? I mean how many lots I should square off at 1st target? And how many lots at second & third target?
    (2) Where I should put my SL?
    (3) Can I use this strategy in multiple scrips in commodity? I mean in 14 -- 16 scrips at a time?
    (4) I am planing for auto trading. Can use Super Trend indicator for auto trading?
    (5) Can I have your mobile number? (Just in case!). Mine is 9604963870.
    Please answer my question kindly. By the way you are doing a great job! God bless you !

  53. Srivatsan says

    Rajandran Greetings
    I am a Fx trader. Looked at your site and infos, very good. Rajandran,thanks for providing good info.
    Am currently using the Pitchfork, inverse correlation, want to use your super trend indictor for one more confirmation.
    I down loaded your Super Trend Indicator for MT4: I have the following clarifications.
    (1) Not able to adjust the thickness of the lines—it stays with the dotted line.
    (2) From one time frame to another—the indicator losses the settings
    (3) What is the period and multiplier it should have
    (4) Guide me to the right super indicator to install in MT4.

  54. DEVESH JAIN says

    rajandaran sir ,

    Can u please help me in reading proper buy signal & sell signal using your supertrend & how to generate profits from the supertrend in nifty futures only. As now a days there are more consecutive huge losses in compare to little profits.

  55. Inder says

    HI Rajendra,

    I have send one email at your support email id. I am requesting you to please reply.

    Thank you,

  56. Anand Pathak says

    In order to avoid false signals given by super trend I desire to club EMA indicator (8, 15).I am using ur verson V3 with ami broker. Kindly guide me to superimpose EMA indicatoron supertrend to get sure shot signals on NIFTY,

Leave a Reply

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