[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Advances in TA: Event flags



PureBytes Links

Trading Reference Links

Hi Tomasz,
this workaround is good, but for a "clean" and fast 
solution it would be better adding 4 or 8 bytes for
this purpose to the price records, and allowing free use/definition
of them by the user. I can imagine it will open more new and
advanced possibilities and add more value to the program
(maybe AB then will be the first program which has this 
built-in, ie. without the need for a second data file).
Please add to wish-list :-)


----- Original Message ----- 
From: "Tomasz Janeczko" <amibroker@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, July 26, 2002 5:20 PM
Subject: Re: [amibroker] Re: Advances in TA: Event flags


> Hello,
> 
> There is even better way to code "binary" fields into OHLC fields
> using bitwise AND and OR operators:
> 
> Lets say that you have 8 events: Event0 upto Event7
> You can ancode them so 
> Event0 = 1
> Event1 = 2
> Event2 = 4
> Event3 = 8
> Event4 = 16
> Event5 = 32
> Event6 = 64
> Event7 = 128
> 
> Now if you want to store the day when Event3, Even5 and Event7
> occurs you can just
> assign 8+32+128 as a closing price.
> 
> Now from AFL level you can use
> 
> IsEvent3 = Foreign("IBM_Flags", "C" ) & 8;
> IsEvent5 = Foreign("IBM_Flags", "C" ) & 32;
> IsEvent7 = Foreign("IBM_Flags", "C" ) & 128;
> 
> That way you can store upto 23 events in single price field,
> so in OHLCVOI you can store 138 events.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "b519b" <b519b@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, July 26, 2002 5:03 PM
> Subject: [amibroker] Re: Advances in TA: Event flags
> 
> 
> > There is an effective work around to do this by making an artificial 
> > ticker for each stock and then using the Foreign() call for testing.
> > 
> > For example, for IBM create a ticker IBM_Flags
> > Put your info into the various price and volume field. That will 
> > give you 6 data items. If you want 10 fields, divide the O, H, L, C 
> > fields in half using the decimal point. It is easy to use AB's 
> > Fraction and Integer calls to get what you want.
> > 
> > If you need a lot of data fields, you can "pack" the data into each 
> > digit of the price and volume fields. And then use AB's Fraction and 
> > Integer calls with appropriate division and multiplication to get 
> > the data items separated. Theoretically you should be able to get 6 
> > digits in the price fields and 9 in the volume and OI fields. But 
> > for safety you can use 5 from each. Also, you can pack 9 digits into 
> > the volume and oi fields, but you can only extract 6 digits since AB 
> > usings changes the data in these fields to decimal data (only 6 
> > significant digits) to do the multiplication and division functions. 
> > Even with just using 5 in each of the 6 regular fields, that gives 
> > you 30 data fields, each with a range of 0 to 9.