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.

Supertrend V3.0 AFL code with Buy and Sell Alerts

36 sec read

Supertrend V3.0 is the upgraded version of Supertrend Indicator. The trading logic remains the same however lot of bugs got removed and few features added in the current version. Multiple Consecutive Sound and Popup alert issue got resolved. Now you will be getting only one sound and popup alert whenever there is a buy or sell signal occurrence.

Features Added
1)Scan Based Popup and Sound Alerts in Amibroker as shown below. If you enabled realtime Scanning now you should see popup coming for the matched scanned scrips.

Realtime Scan Alert

 
2)Supertrend Indicator with Last 5 Trades Dashboard
Nifty Supertrend V3.0

Other Existing Features
1)Trading Dashboard.
2)Non Repainting Indicator.
3)Timeleft feature which alerts end of the current running candle.


Attend Amibroker Workshop - Bangalore - Feb 2014
Attend Amibroker Workshop – Bangalore – Feb 2015

Supertrend V3.0 Amibroker AFL code

If you are very new to trading follow this video to know more about supertrend

httpv://www.youtube.com/watch?v=-Mrtl58u9I0

https://gist.github.com/2f936ff91179676dd9e2

Download Supertrend V3.0 Amibroker AFL code

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.

What is QuantZilla?

Quantzilla is 75+ hours of code mentoring program designed for noncoders who want to learn the coding program right from designing indicators, scanners, trading...
Rajandran R
58 sec read

Things to Consider While Building a Bracket Order Execution…

Building a Bracket Order Strategy is the most demanded request we got from most of the algomojo traders. This article explains the list of...
Rajandran R
12 min read

PlaceOrder – Multi Broker Exectuion Code Snippets for Amibroker

This tutorial explains how to build a button trading right from scratch and with a click of a button how you can send orders...
Rajandran R
7 min read

69 Replies to “Supertrend V3.0 AFL code with Buy and Sell Alerts”

  1. While scan using the analysis getting error 29 on line 475 and col 45 -variable entry used without having been initialized.
    Can you give solution for removing this error.
    Thanks.

    1. You will get such error only if you dont have enough data in any one of the symbol. Its better to have a watchlist with limited set of symbols and also make sure that you have enough candle available in the scanning timeframe.

  2. Should be able to make phone call/sms alert (may be plug model wil help) to your desired mobile using api such as twilio

  3. Sir,

    Please guide how to insert your code in amibroker & RUN THE SAME AS results on your website & results in amibroker is different

  4. Hi Sir,
    I am looking for a afl that gives alert when 78-62% retracement from the pr.high or low. Does it possible to do automatic with the above said requirements. i have found many Fibonacci afls, But nothing shows the reversal exploraion or alert

    1. 1)Make sure you have enough candles in your charts – a min of 200 candles on any timeframe is required
      2)Make sure you are using Amibroker 5.6 version or above
      3)Download the Zip folder or copy the AFL using the Raw button. Avoid copying the AFL directly from the above Editor.

      Following these three steps you should be able to install the indicator properly.

  5. Sri Rajendran, it is a great job. Excellent chart and it is serving many traders.May I suggest a small improvement : A day separating vertical line (dotted) will help in study.
    You may consider to incorporate in the chart.
    Thanks for the excellent chart.

  6. Sir,

    Please guide. I have read all your notes for mapping now RTD to amibroker. my excel sheet RTNOW refreshed properly but no data comes inamibroker.

    Please guide in setup

  7. Hi, sir please try to add additional text, in terms of points moved in short and long trades with respect to high (in case of buy ) and low ( in case of sell ) from the signal, keeping the same last 5 trades . keep the points moved in the sub bracket sir ,so that its easy to take a decision for profit as a scalping , please please post it immediately sir

  8. Thank you sir nest rtd works fine as now replacement . Sir ihave incurred huge losses earlier. can u please tell how to trade on your nifty chart or some good strategy in options so that i can recover my losses.

  9. Hi, I get an error stating Variable ‘entry’ used without having been initialized. this error is appearing sometimes and does not appear sometime in the market watch. But when I click on analysis and explore this error comes every time. Please advice. I use AmiBroker 5.7 with GFDL data

  10. I am not sure but wanted to ask whether there any change in factor and period from 3, 7 to 4, 10. If yes is this to change in market condition. Would like to understand the reason if there was any change

  11. Can u please guide what trade 1 & trade 5 denotes which one is the latest trade. Also what is the calculation crieteria for the same

  12. Hi!

    Thanks for the new version…..it looks good visualy…

    when i tried to backtest in amibroker 5.9,,,it gave NO TRADES in 1.5 year data but when did scan …it gave buy or sell but at the same time short or cover……..

    previous version gave result……

    what is the ideal settings for nifty and banknifty…..without whipsaws….

    thanks

  13. Dear Sir,
    Super trend is really helping us taking correct trading decision, just wondering if there is any possibility to include SL and Target in alertif mail function.

    Regards
    Sandip

  14. Hi sir,

    please add additional information in the afl that pips moved for high in buy signal , and pips moved low for sell signal , please try to add it sir , it will be great help by keeping the same above last 5 trades give this additional information ..thanks in advance sir

      1. Hi sir,

        please add additional information in the afl that pips moved for high in buy signal , and pips moved low for sell signal , please try to add it sir , it will be great help by keeping the same above last 5 trades give this additional information ..thanks in advance sir

  15. Sir,

    It is possible to get last 5 trades report of 15 min or hourly basis trades also at your live charts

      1. may be a drag & drop menu for trade reports work i.e.if person select for 15 min or 1 hour only trade report for that shows

  16. Hi Raj, Thanks for the share. Is it best used in 5 min or 15 min chart ? Coz confused as to in which time frame it works best.

  17. Dear Rajandran,

    “1)Make sure you have enough candles in your charts — a min of 200 candles on any timeframe is required
    2)Make sure you are using Amibroker 5.6 version or above
    3)Download the Zip folder or copy the AFL using the Raw button. Avoid copying the AFL directly from the above Editor.

    Following these three steps you should be able to install the indicator properly.”

    I have met all the 3 conditions however facing the below challenges:

    1. “variable entry used without having been initialized.” error while scanning. I have real-time data since 8th Dec ’14.

    2. Trading Dashboard not visible.

    3. Time Left not visible.

    4. Last 5 trades shows result only of longs and not of shorts.

    Thanks.

      1. Sir what do you mean by 12 consecutive losses some time back, as we are believing only 8 consecutive losses, its strange to me now

  18. Sir, when all the three targets are achieved as per your Super Trend V 3.0, but price is still moving above or below the targets then how to set new targets or stop loss
    can you advice sir

    regards

    1. You have to re-write your rules programatically to do that. Any thing you have to do customization according to your requirement you have to sit and tweak it out programatically.

  19. How long did it take to code with such complex stuff. I just started learning AFL do you have any suggestions what to refer or any courses etc.

  20. How long did it take to code such complex stuff. I just started learning AFL any suggestions.

  21. Hi sir , please try to add just 3 more last trades, so that we can clearly see the last 8 trades resuts, its great help to take the deicsions , please try to add 3 more trade results sir …….hope you will update it asap. thanks in advance sir

  22. sir ..

    Please tell once again ” How to Trade with this formula”

    Profitable ???

    i using but ****

    Please Explain

    Thank you.

    1. Supertrend is yet another trading strategy. So test it out if it suits your risk profile then trade it otherwise try to understand what is your risk ability. Else try to find the strategy thats suits your risk profile.

  23. Hi sir, please see , last 5 trades statistics were showing wrong , please try to coreect it sir, and is it possible to add just 3 more results for it, so total 8 trades visisble clearly , already its great tool adding this will enhance the trader money management please try to see

    thanks and regards

  24. Hi sir , please cehck in few scrips like nicke , silver and also in nifty future stocks trade 4 and trade 5 were showing wrong results, please try to correct them sir, and also please try to add 3 more trade results sir, its a great ehlp please do it sir , thanks alot for sharing this to traders at free of cost

  25. Hi sir, you are giving free servide but to maximise the benefit please check once last trade results are showing wrong sir, please cehck once sir, and also add 3 more trades sir, please please do it sir

      1. Does this mean we need to download the supertrend 4.0 afl again which is corrected for the above said issue? Please advice.

  26. I want to create a dll plugin which reads buy/sell signal from real time data in amibroker. Then I want to send those signals to my website.
    Do I need to code the entire thing in afl ? How should I proceed ?

  27. Dear Sir,
    Am new to this business and just discovered about supertrend could you please let me know how to use this particular version of supertrend in Pi by Zerodha and if not what would be other similar options, if any?

    thanks.

    1. Supertrend is achieved with advance AFL. In other hand Pi itself uses TradeScript and it is very difficult to compose supertrend with it.
      What u could do is to connect Pi with Amibroker with Pibridge, a bridging app comes with one week trial and 500 rs afterwards from Zerodha . Whenever supertrend generate signal , it will automatically published into Pi trading platform under “generated alert” tab.

  28. Sir

    I started using your AFL, which is very good.

    One small issue.
    How to see “trigger value” or stoploss value on “Y axis” sir??

    I can see close value on Y axis, but can’t see stoploss value.
    Can you please help me

    Thanks

  29. What is the meaning of Factor??

    Factor=Param(“Factor”,4,1,10,0.1);

    Pd=Param(“ATR Periods”,10,1,100,1);

    Up=(H+L)/2+(Factor*ATR(Pd));

    Dn=(H+L)/2-(Factor*ATR(Pd));

    iATR=ATR(Pd);

    TrendUp=TrendDown=Null;

    trend[0]=1;

    changeOfTrend=0;

    flag=flagh=0;

    for (i = 1; i Up[i-1]) {

    trend[i]=1;

    if (trend[i-1] == -1) changeOfTrend = 1;

    }

    else if (Close[i]<Dn[i-1]) {

    trend[i]=-1;

    if (trend[i-1] == 1) changeOfTrend = 1;

    }

    else if (trend[i-1]==1) {

    trend[i]=1;

    changeOfTrend = 0;

    }

    else if (trend[i-1]==-1) {

    trend[i]=-1;

    changeOfTrend = 0;

    }

    if (trend[i]0) {

    flag=1;

    }

    else {

    flag=0;

    }

    if (trend[i]>0 && trend[i-1]0 && Dn[i]<Dn[i-1]){

    Dn[i]=Dn[i-1];

    }

    if (trend[i]Up[i-1])

    { Up[i]=Up[i-1];

    }

    if (flag==1)

    { Up[i]=(H[i]+L[i])/2+(Factor*iATR[i]);;

    }

    if (flagh==1)

    { Dn[i]=(H[i]+L[i])/2-(Factor*iATR[i]);;

    }

    if (trend[i]==1) {

    TrendUp[i]=Dn[i];

    if (changeOfTrend == 1) {

    TrendUp[i-1] = TrendDown[i-1];

    changeOfTrend = 0;

    }

    }

    else if (trend[i]==-1) {

    TrendDown[i]=Up[i];

    if (changeOfTrend == 1) {

    TrendDown[i-1] = TrendUp[i-1];

    changeOfTrend = 0;

  30. dear sir!
    I’ve following you for 3 years and really believe in your code honestly.
    Now, I wanna understand the logic to expand or develop it. So, can you explain this text for me to understand what is express for?

    “…………………….”

Leave a Reply to Goodleeu Cancel reply

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