PureBytes Links
Trading Reference Links
|
Thanks
Jayson, Brian<SPAN
class=250013612-10102002>, and Stephane. I will try to digest this
later.
<FONT face=Arial color=#0000ff
size=2>
Now I
have to go to my regular day job. :-(
Not as
much fun as playing with AmiBroker :-)
<FONT
face=Arial color=#0000ff size=2>
<FONT face=Arial color=#0000ff
size=2>-Steve
<FONT face=Tahoma
size=2>-----Original Message-----From: Stephane Carrasset
[mailto:nenapacwanfr@xxxx]Sent: Thursday, October 10, 2002
4:07 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker]
Re: Math transform?Nice "tips",I don't understand
the small difference with A1= your
indicator;AbsVal1=abs(Lowest(A1))+
A1;Val2=(1/Highest(absVal1))*AbsVal1;Plot(Val2*100,"",1,1);>
If I understand you correctly, you want to take variable source >
ranges of values and map them to a static destination range. This is
> a powerful way to equally compare a broad range of indicators,
based > on the historical source range of each indicator. >
> There's probably an easier way, but this is how I do it with my
own > Visual Basic programs. It shouldn't be too difficult to
translate > into Amibroker.> > First define the min and
max of your source and destination ranges. > The SOURCE range,for
example, could be the min and max of TRIX > values over the past
year. We'll call them S_MIN and S_MAX. The > DESTINATION
range is the range you want to map everything to, or > D_MIN and
D_MAX.> > D_MIN = 0> D_MAX = 100> S_MIN = -20 'get
the minimum historical value of the indicator> S_MAX = 60 ' max value
of indicator> MY_VALUE = 30 ' this is the value you want to map,for
example the > latest TRIX value.> > Calculate the
difference between D_MAX and S_MAX.> > DIFF = 0> if D_MAX
<> S_MAX then DIFF = D_MAX - S_MAX > > Next we'll get the
ranges of each...> > D_RANGE = D_MAX - D_MIN > S_RANGE =
S_MAX - S_MIN> > Percentage difference between the
ranges...> > RANGE_DIFF = 0> if D_RANGE<>S_RANGE
then RANGE_DIFF = 100/(S_RANGE/(D_RANGE-S_RANGE))> > We now
have all the info we need to calculate the mapping.> > NEW_VALUE
= INT((MY_VALUE+DIFF)+((MY_VALUE+DIFF)*>
(RANGE_DIFF/100)-RANGE_DIFF))> > > I hope someone finds
this useful! Please report here if you try it.> >
Brian> <A
href="">http://www.tickerank.com/>
> > Steve Davis wrote:> > Here is a question for the
mathematically inclined.> > > > Suppose I have an
indicator, for example TRIX, that has a different> > range of
values for different stocks.> > > > How can it be
mathematically transformed to force it into the same> > range,
say 0-100, for all stocks?> > > > Thanks in
advance,> > -StevePost
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
|