My first post so lets see how it goes…
The link below refers.
This works fine provided the start time co-insides with selected timeframe, else I get null values. for instance, below code on a 5min chart gives null values (note StartTime = 90100;)
tn = TimeNum();
StartTime = 90100;
Endtime = 91500;
StartBar = tn == StartTime;
EndBar = tn == Endtime;
FirstBarsH = ValueWhen( EndBar, HighestSince( StartBar, High ) );
FirstBarsL = ValueWhen( EndBar, LowestSince( StartBar, Low ) );
What I have done instead is to code the below function and it works fine. I am just wondering if my solution is optimal. What I am really after is ignoring the very messy first minute on open in my ORB systems (which run in longer than one minute timeframe).
function marketOpenTimeFrame( shiftFrom, shiftTo, field )
result = ValueWhen(NewDay,TimeFrameGetPrice("O", in1Minute, shiftFrom),1);
for( i = shiftFrom; i <= shiftTo; i++ )
switch( field )
result = Max(result,ValueWhen(NewDay,TimeFrameGetPrice(field, in1Minute, i),1));
result = Min(result,ValueWhen(NewDay,TimeFrameGetPrice(field, in1Minute, i),1));
My Function above does not achieve its objective. In fact it is looking into the future.
Am I correct in saying multiple time frame support allows calculations on “higher” time frames only? For example, 5 minute bars could access arrays from 1h bars, but would not make available the arrays from 1 minute bars?
“Please note that you can only compress data from shorter interval to longer interval. So when working with 1-minute data you can compress to 2, 3, 4, 5, 6, …N-minute data. But when working with 15 minute data you can not get 1-minute data bars. In a similar way if you have only EOD data you can not access intraday time frames.”
@Zargo so the conclusion is you need to be in shorter interval else your code wil not work ?
I am trying to do something along this line , but on the volume metrics, the setup is the following.
1 chart is in daily time fame
2. there ia a marker on Ref(V,-1), indicating yesterday volume , at current time (fig.1)
now i am not sure if that is possibe, given the workings of amibroker. ?
@fourier Best to ignore my code above. You can call dataframes (arrays, indicators) from higher (longer) TF, but not shorter. You can set the chart interval as you prefer.
eg in a 1minute bar chart, I can call yesterday’s Daily H like this
DayH = TimeFrameGetPrice("H", inDaily, -1); // yesterdays high. But I cannot in hourly chart call the H for some 5 minute period.
For completeness, I can achieve my initial objective by setting my backtester periodicity to 1 minute and then call the H for a specified time period (StartTime to EndTime) like this:
NewDay = Day()!= Ref(Day(), -1);
StartTime = marketOpenTime + 100; //ignore 1st 1 minute
Endtime = StartTime + 500; //consider 5 minutes
StartBar = TimeNum() == StartTime;
RangeHigh = ValueWhen(Cross(TimeNum() , Endtime ), HighValue);
Above code returns today’s Highest H for 5 minutes, ignoring the messy open bar.
The thread that discusses this already exists: Displaying Lower TF EMA on Higher TF Chart