Code Amibroker Indicators

Plot Previous Days High & Low for Amibroker (AFL)

by admin January 4, 2019 2 min read 0 comments

Key Takeaways

  • Market conditions and their impact on trading decisions
  • Key levels and price action analysis
  • Risk management strategies for this setup

This code allows you to plot the previous days high and low price on an intraday chart. It also has exploration code to find stocks where the current price is greater than the previous days high or where the current price is less than the previous days low.

Credit to trash on traderji forums for the plotting code

_SECTION_BEGIN( “Price Chart” );
SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( “{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, “Close”, ParamColor( “Color”, colorBrightGreen ), styleNoTitle | ParamStyle( “Style” ) | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN(“Previous Days High & Low”);
function CDL( array )
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy );
Dayline = array * Lastdoy;
return IIf( Dayline, Dayline, Null );
}
H1 = TimeFrameGetPrice( “H”, inDaily, -1 );
L1 = TimeFrameGetPrice( “L”, inDaily, -1 );
Plot( cdl( H1 ), “”, colorYellow, styleLine + styleDashed + styleNoRescale );
Plot( cdl( L1 ), “”, colorYellow, styleLine + styleDashed + styleNoRescale );
Buy = C > H1;
Sell = C < L1;
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Filter = Buy OR Sell ;
SetOption( “NoDefaultColumns”, True );
AddTextColumn( Name(), “Symbol”, 1.0, colorDefault, colorDefault, 80 );
AddColumn( DateTime(), “Date”, formatDateTime, colorDefault, colorDefault, 70 );
AddColumn( C, “CMP”, 1.2, colorDefault, colorDefault, 80 );
AddTextColumn( WriteIf( Buy, “Previous Day High Break”, “Previous Day Low Break” ), “Trade”, 1.0, colorDefault, colorDefault, 50 );
_SECTION_END();

Trading Data Snapshot

Always verify current market conditions before executing any trade. Past performance does not guarantee future results.

A
admin
Trading analyst and market commentator with expertise in technical analysis, price action, and risk management. Dedicated to helping traders make informed decisions.

Leave a Reply