need help following Janeczkoimplementing multiple time frame analysis in AmiBroker

sr114

Well-Known Member
#31
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

What do you mean by smooth and scattered? As far as I know mt4 is only able to work with minute data. But range bars are done with tick data. I'm repeating this again. Provide the tick data you are using. If the next tick is far above or below the last tick then there will be gaps. if price moves from 90.00 to 90.15 and next price after 90.10 is 90.14 and range bar size is 10 and tick size is 0.01 then it will draw a range bar from 90.00 to 90.10 with size 10 and next bar will start at 90.14 so you have a 4 tick gap.
So the main thing is that mt4 can work with minute data to produce range bars and in ami we need tick data for range bars.

can this (minute data) be implemented in ami? rest of the explanation u provided - can this gap (4 tick gap as u say) be reduced any way then mt4 style range bars be produced. ( am i asking too much which is beyond ami or its a stupid question that arises in my mind - ) or what we get in ami is suffucient?

another thing - in our market the tick size is 0.05 , so for these ranges cud u suggest the ranges

1. above 10000 INR scrip (for this i use 1500R)
2. between 1000 -9999 INR (for 5000+ i use 500R is it ok)
3. between 100 - 999 INR (i use 500R)

is these implementation is ok?


sr
 
#32
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

So the main thing is that mt4 can work with minute data to produce range bars and in ami we need tick data for range bars.

can this (minute data) be implemented in ami? rest of the explanation u provided - can this gap (4 tick gap as u say) be reduced any way then mt4 style range bars be produced. ( am i asking too much which is beyond ami or its a stupid question that arises in my mind - ) or what we get in ami is suffucient?

another thing - in our market the tick size is 0.05 , so for these ranges cud u suggest the ranges

1. above 10000 INR scrip (for this i use 1500R)
2. between 1000 -9999 INR (for 5000+ i use 500R is it ok)
3. between 100 - 999 INR (i use 500R)

is these implementation is ok?


sr
YOU CAN'T CREATE PROPER RANGER BARS WITH ANY MINUTE DATA!!!!!!!!!!!!!!!!!

How many times do I have to repeat that to you?! And minute data don't need to be implemented to AB as you can already use minute bars. But again creating range bars with minute data doesn't make any sense!! This has been told to you many times already. I will leave this thread because it's a waste of time.
 

sr114

Well-Known Member
#33
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

YOU CAN'T CREATE PROPER RANGER BARS WITH ANY MINUTE DATA!!!!!!!!!!!!!!!!!

How many times do I have to repeat that to you?! And minute data don't need to be implemented to AB as you can already use minute bars. But again creating range bars with minute data doesn't make any sense!! This has been told to you many times already. I will leave this thread because it's a waste of time.
Detwo

pls dont leave as u are our range bar teacher. i told u earlier that it was a stupid question and u can ignore it.

But the 2nd part the implementation of the ranges - pls give an answer.

sorry to make u irritated - but dont be irritated as student asks stupid question and teacher has to dodge it. pls i am extremely sorry

sr
 
#34
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

I don't use indicators. So I never tried what you wanna do. Take a look at Tickmode.
I thought Tickmode was just for importing tick data, so I'm afraid I don't see how that's relevant; I already use $TICKMODE 1 to import my tick data. Or if by "Tickmode" you instead meant using TimeFrameMode(4), and then TimeFrameExpand(something, N) (i.e., passing a positive integer N to TimeFrameExpand() in order to expand from an N-Range bar frame), I had tried that previously and it didn't work.
 
Last edited:
#35
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

Detwo

pls dont leave as u are our range bar teacher. i told u earlier that it was a stupid question and u can ignore it.

But the 2nd part the implementation of the ranges - pls give an answer.

sorry to make u irritated - but dont be irritated as student asks stupid question and teacher has to dodge it. pls i am extremely sorry

sr
I'm not a teacher I don't have the time teaching whatever. I'm not anyone's nanny. Asking what range bar size is best is like asking what timeframe is the best. It's up to you finding that out!

No harm meant!
 
Last edited:
#36
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

Or if by "Tickmode" you instead meant using TimeFrameMode(4), and then TimeFrameExpand(something, N) (i.e., passing a positive integer N to TimeFrameExpand() in order to expand from an N-Range bar frame), that does not work.
Yes I meant Timeframemode. It was a typo.
I'm not sure it doesn't work. I think you are not sure too since you ask about it.

Does it even make sense to apply indicators on range bars or renko?
 
#37
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

Yes I meant Timeframemode. It was a typo.
I'm not sure it doesn't work. I think you are not sure too since you ask about it.
I had asked that question on the AmiBroker Yahoo forum, and the only suggestion I got was to try TimeFrameMode(4) with TimeFrameExpand(N) (where N is a positive integer); however, I had already tried that myself, and didn't get correct results, which is why I said it doesn't work. Of course, perhaps there's a way to make it work I don't know about.

Does it even make sense to apply indicators on range bars or renko?
Yes -- the range bars act to filter out price oscillations, which in turn filters out those oscillations from indicators built on them. You are simply building indicators on bars that are not linear in time.
 
Last edited:
#38
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

hello Trash, I am new to amibroker and dont have much knowledge of writing afl so if possible can u please help me in writing same code for two condition A and B (suppose A is some buy condition and B is for sell) instead of MACD CROSSOVER.
 
#39
Re: need help following Janeczkoimplementing multiple time frame analysis in AmiBrok

Hi trash. I wanted to take the time to figure things out on my own before replying. I'm now starting to get a handle on this code (pasted below). For instance, I now understand (I think) the following:

IIf() creates an array that contains the value of the indicator at each bar number. Based on the periodicity in Backtester settings, each bar number corresponds to a date/time. AddToComposite() creates an artificial ticker symbol whose value at each time point is that of the indicator (i.e., it’s just the array created by IIf), and whose name is “~XYZ”+Name(), where Name() is the name of the symbol from which the indicator was created. I.e., it’s essentially a specialized export function, and as soon as you run the program you'll see the artificial ticker appear in the symbol list. Turning the array created by IIf() into an artificial ticker symbol allows it to be input into any other .afl file, via the use of Foreign(), which is essentially an import function. That way, you can import your indicator into, for instance, a plotting file: x=Foreign(…); Plot(x,…);. It’s called “Foreign” because it allows you to reference a ticker symbol different from (i.e., foreign to) the currently active one. [Personally, I think these would be far less cryptic if they were instead named "ExportArtTick" (or "CreateArtTick") and "ImportArtTick" (where ArtTick means artificial ticker). And I wish there were somewhere in the manual it had been explained in this fashion!]

Scan has to be run to create the indicator from the code. However, I have found it is NOT necessary to include any Buy statements to run Scan. All Buy=1 gives you is a listing, in the Scan window, of the value of the indicator at each time point (if you’re curious to see it) -- as expected, since it just tells you to Buy at every bar. But even if you don’t include Buy=1, the artificial ticker is still built when you run scan (as evidenced by its appearance in the symbol list, and the fact that you can plot it). Indeed, it even works if you set Buy=0. So I don’t understand what purpose Buy=1 serves, other than displaying the indicator values at each time point in the scan window. Of course, should you wish to backtest your code, you will need a Buy statement (for longs), but in that case you would use the actual Buy criterion, and not Buy=1. Curiously, nothing comes up when I search for “Buy” in Help, so I was unable to find detailed information about this reserved variable.

Now, returning to the outstanding issues from our previous exchange:

Regarding no. 1: Here’s the code that requires I hit “scan” twice before I see trades in the scan window:

**********
Count = 0;
result = 0;

for( i = 10; i <= 300; i++ )
{
TimeFrameSet( i * in1Minute );
m = MACD(12, 26 );
TimeFrameRestore();
m = IIf( TimeFrameExpand( m, i * in1Minute ) > 0, 1, -1 );
result = result + m;
Count++;
}

AddToComposite( result / Count, "~MACD"+Name(), "X" );
x = Foreign("~MACD"+Name(),"C");
Buy = Cross(x,-.5);
Sell= Cross(.5,x);
BuyPrice = SellPrice = Close;
*************

However, if I substitute this code after the closing bracket of the "for" loop, I only have to hit scan once:

x=result/Count;
Buy = Cross(x,-.5);
Sell= Cross(.5,x);
BuyPrice = SellPrice = Close;

So it seems it's the extra step of creating the artificial ticker, and then importing it back into the program, that accounts for the need to hit scan twice.


Regarding no 2: I can now explain the effect I was seeing: Let’s suppose you create the above composite indicator. Since it was built on a 1-minute periodicity, it has values for every minute. However, if you display it under a daily or weekly chart, you will only see its values at the close of each daily or weekly bar (i.e., its plotted value will only change once per day or week, respectively). That’s why, for these longer time frames, the frequency (rate of change per unit time) of the indicator decreased when I went from a daily to weekly view – because it went from changing once per day to once per week. However, we don’t see that effect at short periodicities (say, going from a 1-minute to a 5-minute bar display), because this is a slow indicator, and thus the time scale at which one sees changes is long relative to 1-minute or 5-minute bars. Hence changing the display from 1 minute to 5 minutes has no effect on the displayed frequency of the indicator. [In case this is not clear: suppose the true value of the indicator characteristically changes about once every few hours. Then, regardless of whether you display 1 minute or 5 minute bars, the displayed value of the indicator only will be seen to change once every few hours.]

So, in summary, at displayed time scales that are short relative to the characteristic true frequency of the indicator, changing the periodicity of the display has no effect on the displayed frequency of the indicator; however, at displayed time scales that are long relative the characteristic true frequency of the indicator, it is the displayed time scale that determines the displayed frequency of the indicator.

Dear Theorist

As i have applied this afl, it is working fine but the issuse i faced is when i am looking 1 minute chart than value of Multi time frame MACD of previous 3-4 bars is keep on changing, how can i fix the value of MTMACD in each i minute bar, like if the value of MTMACD was 0.53 at the time of closing of 1 minute bar than it should remain constant for that particular bar.
 

Similar threads