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 High-Low Breakout Strategy – Amibroker AFL code

1 min read

The Traditional Supertrend strategy is buy whenever the trailing stoploss breaks on the higher side and reverse to shorts when it breaks on the lower side. And the Buy or Sell Decision is taken on the close of the candle.

Supertrend High Low Breakout

 
Now how to create a strategy where when the supertrend turns to buy mode and the reference high is marked at the time of supertrend turning to buy mode. But still the actual buy will come only if the high is taken out on the upper side. Similarly when the supertrend turns to sell mode and the reference low is marked at the time of supertrend turning to sell mode. But still the actual buy will come only if the low is taken out on the lower side. When the Reference High or Low is not broken yet then the old position(Long or Short) continues.

It is just a prototype strategy to demonstrate how such logical conditions can be incorporate in your strategy to bend the system the way you required.

Why Such a Strategy?
When there is a high volatility in the market and when your supertrend signals comes at huge spike then probably some of the cases you will end up catching the signal at the peak. Most of the Big Gapup and Gap down and then a sharp reversal without taking a newer high or newer lows in such a scenario you will be end up saving a few bucks in your strategy. However it has it own disadvantages too as it delays your trading position to take at a little higher price every time as it waits for reference high or low breakout.

Steps to Install

Download Supertrend High-Low Breakout – Amibroker AFL code
2)Unzip Supertrend High-Low Breakout.zip to local folder
3)Copy Supertrend High-Low Breakout.afl file to \\program files\\amibroker\\formula\\basic folder
5)Open Amibroker and Open a New Blank Chart
6)Goto Charts->Basic Charts and apply/drag-and-drop the Supertrend High-Low Breakout code into the blank chart
7)Bingo you are done. Now you will be able to see the Supertrend High-Low Breakout system with Buy and Sell signals.

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

17 Replies to “Supertrend High-Low Breakout Strategy – Amibroker AFL code”

  1. Dear Sir,
    Can you please provide AFL for MACD Histogram Divergence & Hidden Divergence (As shown in your Chart)

    Waiting for your reply.
    Vishnu dutt kaushik

  2. Dear Sir,

    Happy Dusshera.
    What are the parameters used by you in Supertrend, e.g. multiplier, period, trend mode etc.

    Sorry, i went through the AFL code, but am not familiar with AFL syntax, so could not figure out by myself.

    p.s. Yours is the only website in the world that talks about automation frankly and openly. Every one else is secretive and closed about this field.

    Thanks,
    Naren

    1. p.s. Yours is the only website in the world that talks about automation frankly and openly. Every one else is secretive and closed about this field.
      I appreciate this comment of Naren.
      I feel Rajendran is educating the retail investors in beating the big sharks of financial market.. Great work Raj.

  3. Dear Rajandran

    I’ve tried the code; Not able to get the indicators (arrow marks) on the chart. Is there any parameter that needs to be set?

    thanks,Tarak

  4. Rajandran Sir,

    I am use GCI MT4 live charts, i like formula – how to change (Amibroker) AFL code to (GCI MT4) .ex4 code, or how use for MT4 Chart – Supertrend High-Low Breakout
    I am wait for your kind advice, Thanking you

  5. Dear Rajandran

    I was trying supertrend. sometimes it shows a sell signal and then that disappears (in same candle)(i was using 3 min chart). how can we eliminate that?

    your website is really good)
    Thanks

  6. Hi Rajandran,

    I like this strategy very much and it’s my answer that looking for a solution to avoid trading when there’s no new HH,LH, LL or HL. However I’m newbie in Amibroker but I want to customize your AFL to suit my need. So I would really appreciated if you can guide me on these inquiries

    1. What if I want to manually adjust the number of bars to look back for previous high an low? where in your AFL should I go to and edit it?

    2. If I want to use “param” function for user input.

    Thank you so much in advance and looking forward to hearing from you.

      1. sir, how is possible high low in closing basis? there is meaningless if close in next close candle.I also request that if any member buy algostudio, your side provided some goods afl. thanks. without afl i cant do anything. thanks.

  7. Hi,

    Can Share the Afl for if stock move rise or fall 3% in a day.
    Buy Side if it cross it cross previous day low then buy
    Sell Side if it cross previous day high then sell

Leave a Reply to J Chaudhari Cancel reply

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