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.

10 things to know about Supertrend v2.0 AFL code

1 min read

 

This time coming up with an upgraded version of Supertrend indicator with sound and popup alerts. Here are instructions for those who follow Supertrend v2.0 to trade in a better manner. The installation steps are listed below


10 things you need to know about Supertrend

1)Supertrend is a carry forward strategy that 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 scenarios

4)Should works well with High Beta Stocks and High Volatile Stocks.

5)Supertrend has two input factors Multiplier and ATR. the default value is 3 and 10. Increasing the multiplier will increase the risk and decrease profits. (Tested across all the timeframes). And lower multiplier values will result in more trades which means more commissions and more slippages.to pay.

6)Always start your trade when the past trades in which you hadn’t participated shows the worst. Don’t start once you have seen the best best part of profits in the 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.

7)Winning ratio is more or less between 40-45% across all the smaller timeframes. (doesn’t includes brokerages and slippages). However, most of the time higher time frame involves high risk in trading supertrend indicators.

8)Pinescript strategy supports Alerts whenever there is a buy or sell signal in place.

9)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 the most profitable signals.

10)Risk responsibly as supertrend doesn’t predict anything but just captures the trend when it is there and does risk management when there is no trend is there.

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.

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.

Algomojo Index Straddle/Strangle Execution Module with Intraday Stoploss

This tutorial focus on how to automate your index straddle/strangle strategy with intraday stop-loss levels with time-based entry and exits using Algomojo Platform and...
Rajandran R
7 min read

Learn How to Login into Algomojo Account using Amibroker

In the last tutorial, we learn how to automate the algomojo login process and in this video tutorial, we are going to learn with...
Rajandran R
1 min read

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

131 Replies to “10 things to know about Supertrend v2.0 AFL code”

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

    1. Thanks OSK. This is the requirement from many traders hope it would be useful for them. And future AFL codes will have option to enable/disable Popup and Sound Alerts.

      1. Yes it is one of main requirement of many, and if you can include Email Alert also it would prove to be highly beneficial. So please try to consider this request.

          1. Thank you and BTW recently you conducted a seminar. Are you planning for conduct any in near future? If not how about webinars?

            Please do let us know.

    2. Hi,

      Which coding language people using to write strategies on tradjngview website.

      Actually I had found a strategy on that website and interested to use it for day trading ( I want to trade whenever system generate signals, and looking for a broker who allows robot trading )

      Please guide me on this.

      Thank you

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

    Regards,
    Parthasarathy

    1. @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. 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.

    1. 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. 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.
    Regards,
    Parthasarathy

  7. 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
    GOLD, SILVER
    COPPER, NICKEL
    CRUDE, NGAS
    LEAD, ZINC, ALUMINIUM

    1. Value rt provides 6month data and EOD data and it is good to backtest atleast 6month .

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

    Regards,
    Durgesh

  9. Hi,
    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. 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. sir,
    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. 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. 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. 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. 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.

    1. @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. 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

    1. 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. 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. 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?

    1. 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. Dear sir thnx for ur work.. can u plz give me any idea about A mibroker ..i want to install ..

  20. Sir
    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….

  21. Sir,
    Can we use this Supertrend AFL for exploration also?
    if yes then please explain how

    1. Currently super trend is not configured for performing exploration. You need to do your homework for implementing exploration with supertrend.

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

  23. 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”.

  24. Can this AFL be used to take positional trades in Stocks?

    or it should only be used for Index futures?

  25. 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?

    1. 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?

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

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

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

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

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

    Regards,

    Veer

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

  32. 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
    hello
    thanks

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

    1. 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 24×5 forex markets.

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

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

  34. sir i am trader (commodity)i want your softwair with buy sell signal with arro & parabolic dots

  35. Hi Rajendran,

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

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

    Thanks

    Venu Gopal

        1. Hi Rajendran…

          I have not got any reply from you or from OSK again. Please reply to my original request.

          Regards

          Venu Gopal

  37. can i have backtest report file for the live signal section for bank nifty and nifty futures?

  38. 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.
    http://www.4shared.com/file/rFZOqA8P/nifty_super_trend_back_test_re.html

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

  40. Hi Kiruba, not able to find the backtesting results for 12 min in your attached file.

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

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

  43. 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 ??

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

  44. 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 ??

  45. Hi Rajandran,

    Thanks for the Supertrend code.I m much interested in watching the difference between the super trend and intratrend.It ll be more helpful for me in study purpose if you could enable the intratrend chart for few days http://www.marketcalls.in/intratrend.

    Thanks and Regards

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

  47. 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,
    Rajendra

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

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

    Thanks,
    Mrityunjay

  50. 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?

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

  52. Hi Rajandran,

    How to calculate the stop loss when using this strategy in Nifty Futures…..

    Regards
    Deepak

  53. Sir,
    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

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

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

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

  56. 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?

    Regards,
    Akhilesh

  57. Sorry Sir, It’s not working. I’m using the amibroker for the Stock exchange Việt Nam

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

  59. Dsir
    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

    1. Try to use a Quality datafeed and in the website we are using the parameters ATR=10 and Multiplier = 4. Check it out your default parameters could be different.

  60. 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 🙂

  61. Can u kindly tell me about the target parameters used whn applying this afl on index options???

    Thank You

  62. 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 !

  63. 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.
    Regards
    Srivatsan

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

  65. HI Rajendra,

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

    Thank you,

  66. 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,

  67. Dear Rajendran , As it is written above “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. . 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.”

    My query is – By sseing the charts , How to determine if past trades have delivered consecutive losses ?

    Regards.

  68. Hi, This is Ajmal from India. Have come across your portal. Pretty impressive. I trade intraday in Equity and Commodity(mostrly in Crude). Can you please tell me how to use this super trend automation. I am using MT4.

    Thanks.

  69. Your strategy is good. Golden mean.
    Only concern is:
    – If trading is about beating time, how time constrained plays like intraday and fno help you win?
    – How to tell, which higher or lower level cycles are going to take over?

  70. Hi Rajendra,,,

    Great work done. very useful for someone who is new to Technical Analysis.

    Thanks.

  71. Dear Mr Rajendra,
    Really appreciate your efforts which you render via marketcalls.in. My question to you is can this new version of Supertrend be used in Pi by Zerodha and how also if not what would be similar alternatives for the same.

    Thanks.

  72. HELLO SIR, FROM LAST 2 TO 3 MONTH U HAVE STOPPED THE LINK marketcalls.in/options which was very useful for option trader . kindly start it again if it is possible

  73. Hi Sir

    I would like to seek your help.

    whenever i trade in options i end up in losses. also whenever i carry forward my position the market behaves the oposite directions.

    how can i come over it.
    am using the super trend parameter as 5 4 in 5 minutes chart in bank nifty options

    pls help me

  74. in super trend what is the period and mutiplyer are good for mcx trading sir
    \

Leave a Reply

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