I am a novice and I’m trying to develop a simple trading system with 5 min. time frame that enter the trade when the High of a bar is greater than the High
of the previous day in daily time frame. I’ve read the tutorial “Multiple Time Frame support in AFL” but i don’t understand how it works in this case.
Here and excerpt from my code:
for( i = 1; i < BarCount; i++ )
PreviousMax = Ref(H,-1);
if (H[ i ] > PreviousMax) then
Setup = 1;
Buy[ i ] = True;
priceatbuy = BuyPrice[ i ];
//and so on...
Obviously, This code give me only the value of the previous day of the last daily bar of the entire period but I want to get the value of every single
"previous day" of the period I’m analysing.
Thus, the question is: how can I keep in touch the High value of a 5 min. bar in a day with the corresponding High (daily) of the day before?
No you did not. Reading is not the same as “scanning”. Reading is more than just looking at text. Reading is about UNDERSTANDING. People nowadays don’t read. They scan text.
The code is completely wrong. TimeFrameSet must NOT be used inside loop. If your read the manual first http://www.amibroker.com/guide/h_timeframe.html you would find out that what you are trying to do is documented in manual and requires SINGLE LINE of code
// gives previous Day High when working on intraday data
prevmax = TimeFrameGetPrice( "H", inDaily, -1 );
Bottom line: start READING the docs carefully and possibly MANY TIMES until it sinks! Literally EVERYTHING is covered in documentation. AmiBroker documentation is CONCISE. Every word and every sentence is important.