Thursday, August 25, 2016

Amibroker AFL For Previous Day High Low Close Levels

Previous day High Low and Close Levels are very important reference points for intraday traders. Many traders call them as Yesterday levels, Last day levels also. In Amibroker charts, most intraday traders use these levels by marking them manually through a horizontal line. Amibroker AFL for previous day high low close levels will automatically plot these levels on current day's intraday chart. This Amibroker AFL for previous day high low close levels will plot the levels only on current day's chart so there will be no clutter.

Simply three lines of previous day high , previous day low and previous day close will be plotted. The colour red line is previous day high, the clour green is previous day low and the colour light grey is previous day close.

You may also like: Top 10 Amibroker AFL

amibroker afl for previous day high low close levels
Previous Day High Low Close Levels Chart

Download Amibroker AFL For Previous Day High Low Close Levels


  1. how to extend this horizontal line both side? and display value?

    1. I am giving a code below which is different from the above code.

      Apply the below given code through the Formula Editor & you will get text written Previous day OHLC & also the values.


      Plot(TimeFrameGetPrice( "H", inDaily, -1 ),"PDH",colorBlue,styleThick);
      PlotText("High",BarCount,LastValue(TimeFrameGetPrice( "H", inDaily, -1 ),True),colorBlue);
      Plot(TimeFrameGetPrice( "L", inDaily, -1 ),"PDL",colorRed,styleThick);
      PlotText("Low",BarCount,LastValue(TimeFrameGetPrice( "L", inDaily, -1 ),True),colorRed);
      Plot(TimeFrameGetPrice( "O", inDaily, -1 ),"PDO",colorLightGrey,styleLine);
      PlotText("Open",BarCount,LastValue(TimeFrameGetPrice( "O", inDaily, -1 ),True),colorLightGrey);
      Plot(TimeFrameGetPrice( "C", inDaily, -1 ),"PDC",colorDarkGrey,styleLine);
      PlotText("Close",BarCount,LastValue(TimeFrameGetPrice( "C", inDaily, -1 ),True),colorDarkGrey);

  2. Dear Aryan,

    First of all thank you for the wonderul AFL's you keep posting.

    I am wondering if you do have an AFL code which could plot horizontal lines at the highest price and lowest price of the last 3 days.

    For ex :

    Day 1, High = 10000, Low = 9950
    Day 2, High = 10025, Low = 9975
    Day 3, High = 10030, Low = 10000

    On Day 4, the AFL could two horizontal lines, one at the highest price of the last 3 days, i.e. 10030 and the other at the lowest price of the last three days, i.e. 9950.

    Appreciate you help.


    1. Hi Nayan,

      Thanks for your comment.

      Okay, check back in 3-4 days, I will try to post such AFL.

      Happy Trading !!


  3. Hello Aryan,

    Tried coding this last night.
    I think it works, may I request you to validate please whenever you do find sometime.

    H2 = TimeFrameGetPrice("H", inDaily, -2); // yesterdays high
    L2 = TimeFrameGetPrice("L", inDaily, -2); // low

    H3 = TimeFrameGetPrice("H", inDaily, -3); // yesterdays high
    L3 = TimeFrameGetPrice("L", inDaily, -3); // low

    x = IIf( H1 > H2, H1, H2 );
    HA = IIf(x > H3, x, H3);

    y = IIf( L1 < L2, L1, L2 );
    HL = IIf(y < l3, y, l3);

    Sorry if this isnt the way to code this, but I ain't a coder, just trying my hands on something interesting.


    1. Hi Nayan,

      I have posted the AFL which plots the 3 Day Highest High & Lowest Low Values & lines on the Chart.

      Link Under:

      Happy Trading !!

  4. Hi Aryan,

    Please discard my previous comment. I was able to get the current day open price by modifying a very minor thing in your original code -

    function CDL( array )
    doy = DayOfYear();
    Lastdoy = doy == LastValue( doy );
    Dayline = array * Lastdoy;

    return IIf( Dayline, Dayline, Null );

    H1 = TimeFrameGetPrice( "H", inDaily, -1 ); // yesterdays high
    L1 = TimeFrameGetPrice( "L", inDaily, -1 ); // low
    C1 = TimeFrameGetPrice( "C", inDaily, -1 ); // close
    DayO = TimeFrameGetPrice("O", inDaily); // current day open

    Plot( cdl( H1 ), "", colorRed, styleLine + styleThick + styleNoRescale + styleNoLabel );
    Plot( cdl( L1 ), "", colorBrightGreen, styleLine + styleThick + styleNoLabel );
    Plot( cdl( C1 ), "", colorBlue, styleLine + styleNoRescale + styleNoLabel );
    Plot(cdl( DayO ), "", colorWhite, styleLine + styleNoRescale + styleNoLabel );

    Kindly look into the intraday volume breakout afl/exploration request that i have posted couple of days back.

    Thank you and Happy Trading !


    1. Hi Jaspreet,

      Good to know you included the Open price in the AFL as per your requirement. Regarding Volume Breakout AFL , be assured if it is done it will be surely published by me & I am trying to find time from my crunching schedule to have a look at the same.
      Happy Trading !!



Required US Government Disclaimer & CTFC Rule 4.41

Futures trading contains substantial risk and is not suitable for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only consider risk capital that should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. CTFC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS SUCH AS LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN. All trades, patterns, charts, systems, etc., discussed in this website or advertisement are for illustrative purposes only and not construed as specific advisory recommendations. All ideas and materials presented herein are for information and educational purposes only. No system or trading methodology has ever been developed that can guarantee profits or prevent losses. The testimonials and examples used herein are exceptional results which do not apply to average people and are not intended to represent or guarantee that anyone will achieve the same or similar results. Trades placed on the reliance of Trend Methods systems are taken at your own risk for your own account. This is not an offer to buy or sell futures interests.