I found the "Performance" function and thought it looked useful for some ideas I have, but I'm not able to reproduce the result.
In a watch list, I created a script column with the code:
PERFORMANCE()
As an example, for ABCB:NASDAQ i get a result of 18.88, but I can't get the same result manually no matter which of the Open, Close, High or Low prices I use.
I feel a bit silly asking, but can you tell me how the 18.88 is calculated please.
The Performance() function measures the range between two values over a user defined period (1 month by default) and displays the results as a percentage. For example if a charts price moved from $50 to $100 in a month, PERFORMANCE() would return a value of 100%.
If you are unsure of how a function works, you can find a brief overview / description here:
Thanks Matthew, much appreciated. BTW, the link you gave me is how I found the function in the first place! :-) Sadly, I don't think it's the one I want.
What I'm trying to do (and failing miserably at) is find out how many bars, in this case monthly, have had greater than a certain range in a period as these are the type of stocks I want to trade.
I thought this should work but the result is either 12 or 0, not the number of bars where the test is true. Can you help?
// Set minimum percentage range RATE1 = 5 ;
// Check price has risen BAR1 = BARTYPES(Month(PERIODAMOUNT=1), DEFAULT=CloseAboveOpen) ;
// Check percentage range in month is greater than minimum BAR2 = (HIGH(MONTH()) - LOW(MONTH())) / LOW(Month()) * 100 > RATE1;
BAR3 = BAR1 and BAR2;
// Count how many times that has been true in last 12 months BAR4 = BARSTRUE(Month(PERIODAMOUNT=1), BAR3, LOOKBACK=12) ;
That's perfect, exactly what I wanted and I can see so many other uses for ACC. Many thanks indeed!!!
As a matter of interest only, why did ACC work so much better than BARSTRUE? Will ACC always produce a more reliable result or are there particular circumstance where one is more appropriate than the other??