Performance function

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.

Hi Steven,

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%.

Ex2

If you are unsure of how a function works, you can find a brief overview / description here:

https://help.optuma.com/kb/faq.php?id=714

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) ;

BAR4

Hi Steven,

I think using the Accumulation ACC() and the monthly Rate of Change ROC() functions is the way to go.

//Set % rate
RATE1=5;
//Calculate month % change
V1=ROC(Month(PERIODAMOUNT=1), BARS=1);
//Count how many monthly ROC > RATE1 over last 12 months
ACC(V1>RATE1, RANGE=Look Back Period, BACKTYPE=Months, BARS=12)

Here’s the formula in a watchlist and Show View, so WBA and BA both have had 5 months greater than 5% over the last year:

Capture

 

Hi Darren,

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??

Further to Darren’s illustration on WBA above, I can plot the Show View to show when only December is up with below scripts:

c1 = MONTHNUMBER()==12;

c2 = ROC(Month(PERIODAMOUNT=1), BARS=1) > 0;

c3 = c1 and c2;

But when I want to know how many December is up in past 5 years, below script does not work:

ACC(c3, RANGE=Look Back Period, BARS=5, BACKTYPE=Years) (Timeframe is default)

Kindly advise.

Hi May,

You need to wrap a Monthly function around the C3 variable like this:

C1 = MONTHNUM() == 12;
c2 = ROC(Month(PERIODAMOUNT=1), BARS=1) > 0;
c3 = MONTH(c1 and c2);
ACC(C3, RANGE=Look Back Period, BACKTYPE=Years, BARS=5)

This allows the accumulation to count each monthly pass as a single value regardless of the charts time frame.

Ex2