February 4, 2019 at 12:43 pm #51143
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:
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.February 4, 2019 at 12:56 pm #51147
- Topics: 4
- Replies: 89
- Posts: 93
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:February 6, 2019 at 1:34 pm #51187
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) ;
BAR4February 7, 2019 at 1:09 am #51195
- Topics: 31
- Replies: 172
- Posts: 203
I think using the Accumulation ACC() and the monthly Rate of Change ROC() functions is the way to go.12345678//Set % rateRATE1=5;//Calculate month % changeV1=ROC(Month(PERIODAMOUNT=1), BARS=1);//Count how many monthly ROC > RATE1 over last 12 monthsACC(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:February 8, 2019 at 3:10 pm #51215
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??
You must be logged in to reply to this topic.