[Newbie] How to get daily code working for intraday candles?

Newbie here. Still not totally comfortable with all the ins and outs of Amibroker. I want to create a basic 10 day high breakout code. I started off with the following code from http://forum.amibroker.com/t/scan-for-price-retesting-break-out-levels/729/2:

BarLimit = 10;
Resistance = Ref(HHV(H, 10), -1);
Breakout = Cross(H, Resistance);
BreakoutLevel = Ref(ValueWhen(Breakout, Resistance), -1);
Retest = Cross(BreakoutLevel, L) AND BarsSince(Breakout) <= BarLimit;

Filter = Breakout OR Retest;
AddColumn(H, "High");
AddColumn(L, "Low");
AddColumn(Breakout, "Breakout", 1);
AddColumn(BreakoutLevel, "BreakoutLevel");
AddColumn(Retest, "Retest", 1);

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) \n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C,"C",colorBlack,styleCandle);
PlotShapes(Breakout * shapeUpTriangle, colorGreen, 0, Resistance);
PlotShapes(Retest * shapeDownTriangle, colorOrange, 0, L);

I tested this code using the "explore" option. This code seems to work on daily candlesticks. I want to get it working for 15 minute candlesticks. I tried using the TimeFrameSet(in15minute) option in the first line, but I got no change to the output.

How can I achieve what I want?

After finishing compression of variables of daily interval you need to expand them to shorter interval. Have you looked here https://www.amibroker.com/guide/h_timeframe.html

BarLimit = 10;

TimeFrameSet(inDaily); 
Resistance = Ref(HHV(H, 10), -1);
Breakout = Cross(H, Resistance);
BreakoutLevel = Ref(ValueWhen(Breakout, Resistance), -1);
Retest = Cross(BreakoutLevel, L) AND BarsSince(Breakout) <= BarLimit;
TimeFrameRestore();

Breakout = TimeFrameExpand(Breakout, inDaily, expandLast);
BreakoutLevel = TimeFrameExpand(BreakoutLevel , inDaily, expandLast);
Retest = TimeFrameExpand(Retest , inDaily, expandLast);

Filter = Breakout OR Retest;
AddColumn(H, "High");
AddColumn(L, "Low");
AddColumn(Breakout, "Breakout", 1);
AddColumn(BreakoutLevel, "BreakoutLevel");
AddColumn(Retest, "Retest", 1);

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) \n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C,"C",colorBlack,styleCandle);
PlotShapes(Breakout * shapeUpTriangle, colorGreen, 0, Resistance);
PlotShapes(Retest * shapeDownTriangle, colorOrange, 0, L);

I don't think I explained myself correctly.

The code you posted does the same thing as the code I posted (at least the output was the same), except it works based off intraday candles. This is NOT what I want.

I want the code to consider the last 10 15minute candles, not daily candles. So, when the highest high of the last 10 15minute candles gets broken, it generates a signal.

@TheNutz
Read TimeFrameSet you will know what to change to get desired result.....

@TheNutz you don't want a 10 DAY breakout, but a 10 bar breakout.

Set your AA (analysis) and chart settings to 15 minute bars

1 Like

@portfoliobuilder Yes. This is what I want. I'll see if I can make it work.

Silly me. I feel like an idiot. It was just a matter of changing the periodicity in the Analysis settings. I was trying different combinations of the TimeFrameSet function, but couldn't get it to work.