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

Re: [amibroker] Re: Percentile for Up Bar array not returning correct value.[Not do-able in AB?]



PureBytes Links

Trading Reference Links

Hello,

Move (copy) non-empty elements  using looping to contiguous range and run Percentile
on smaller number of bars.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "ChrisB" <kris45mar@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, August 24, 2007 5:18 PM
Subject: Re: [amibroker] Re: Percentile for Up Bar array not returning correct value.[Not do-able in AB?]


> Still working on this...
> 
> Unless I can populate an array with a true Empty value, like a virgin 
> Excel cell, it does not look like I can do this in AB.
> 
> For this to work I would need to be able to populate bars on an array 
> with a *true* empty value, which AB would ignore in its Percentile 
> calculation.
> 
> If we try:
> 
> UBHR = IIf( Upbar, HR, Null);
> UBHR = IIf( Upbar, HR, -1e10);
> UBHR = IIf( Upbar, HR, 0);
> UBHR = IIf( Upbar, HR, ASC("B"));
>  (to try and recreate the Excel if(xx,HR, "") empty value for a cell)
> the NOT Upbar is always populated with a zero or false value.
> 
> Also looking at the IsNull, IsEmpty, isNan, these also return value of Zero.
> 
> So
> 
> array1 = 1     12  56     21     12 // which is what I can use in Excel
> and
> array2 = 1  0  12  56  0  21  0  12 // which is what I get in AB
> 
> will always have different percentile values. Pity.
> 
> For the moment I have drawn a blank and will ask support for help, and 
> look for an alternate method.
> 
> Regards
> ChrisB
> 
> 
> ChrisB wrote:
>> 
>> 
>> Thank you GP.
>> 
>> I've had a look at these.
>> 
>> However, I don't think think the issue is with how AB calculates the
>> Percentile.
>> 
>> In the attached Perc_Excel.png the value in cell E3 matches that for the
>> Value in AB's exploration seen in the attached Perc_Expl.png. See last
>> value in column HR PC.
>> 
>> However, when I try to return the Percentile value for the array of High
>> Ranges for UpBar days, (last value in UBHR PC) this does not match the
>> value in cell M3 in the Perc_Excel.png. So I am either
>> 
>> a. not able to use this in AB if the Array continues zero or null
>> values, although clearly I can in Excel
>> 
>> or
>> 
>> b. not using the Addcolumn(Percentil e(UBHR,20, 80),"UBHR PC", 3.2, 16,
>> 55, 60); correctly
>> 
>> So I come back to my first question:
>> how shall I get AB to return to correct Percentile value for an array
>> that has High Range values only on UpBar days?
>> 
>> I was glad to see the Percentile function in AB because I thought this
>> would be a short way around. If I cannot use this I may need help with a
>> more long winded way.
>> 
>> Thanks for the link.
>> 
>> ChrisB
>> 
>> gp_sydney wrote:
>>  >
>>  >
>>  > I'm not sure of the answer to your question, but note that there are
>>  > different ways of calculating percentile. See:
>>  >
>>  > http://www.itl. nist.gov/ div898/handbook/ prc/section2/ prc252.htm
>>  > <http://www.itl. nist.gov/ div898/handbook/ prc/section2/ prc252.htm 
>> <http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm>>
>>  >
>>  > That document specifically mentions how Excel does it.
>>  >
>>  > Regards,
>>  > GP
>>  >
>>  > --- In amibroker@xxxxxxxxx ps.com <mailto:amibroker% 40yahoogroups. 
>> com>,
>>  > ChrisB <kris45mar@x ..> wrote:
>>  > >
>>  > > Hi Group
>>  > >
>>  > > When I do an exploration for the High Range of Up Bars, I cannot get
>>  > the
>>  > > Percentile function in AB to return the same value as in Excel. How can
>>  > > I achieve this?
>>  > >
>>  > >
>>  > > Here is what I am doing.
>>  > > // this is exploration for EOD forex data.
>>  > >
>>  > > Factor = Iif(StrRight( Name(),3) =="JPY",100, 10000);// converts price
>>  > to Pips
>>  > >
>>  > > upBar = C > O; // bars closing up from the open
>>  > > HR = factor * (H - O);// fills array with the high range of all bars.
>>  > >
>>  > > UBHR = Iif(upBar,HR, 0);// fills array with High Range for Up Days, and
>>  > > zero for all other days.
>>  > > UpTh = UP threshold = Param("Up Threshold",10, 10,200,1) ;
>>  > > n = Param("N bars back", 100, 1, Barcount -1, 1);
>>  > >
>>  > > Addcolumn( Percentile ( HR, 20, 80), "80th centile of HR", 3.2, 16,
>>  > 47,60);
>>  > > // this matches my Excel value
>>  > >
>>  > > Addcolumn( Percentile ( UBHR, 20, 80), "80th centile of UBHR", 3.2, 16,
>>  > > 47, 60);
>>  > > // this does not match my Excel value
>>  > >
>>  > > How can I get the Percentile array to look only at the Up bars' High
>>  > ranges?
>>  > >
>>  > > I need to know what the High Range value is which contains 80% of High
>>  > > Ranges on Up Bars only.
>>  > >
>>  > > Any ideas?
>>  > >
>>  > > ChrisB
>>  > >
>>  >
>>  >
>> 
>> 
>> ------------------------------------------------------------------------
>> 
>> 
>> ------------------------------------------------------------------------
>> 
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/