Screening performance since 1th day of year
Forums › ProRealTime English forum › ProScreener support › Screening performance since 1th day of year
- This topic has 12 replies, 2 voices, and was last updated 8 years ago by Andrea Tironi.
-
-
05/08/2016 at 8:26 PM #6591
Hi.
Is there a way to create a screener that ishows performance since 01.01?
Thanks.
Andrea
05/09/2016 at 9:10 AM #6602Hi,
Because ProScreener has a limitation of 254 bars lookback, I coded this little indicator to compute the performance of an instrument since the first day of the year.
123456789101112131415161718once previousbar = 0once hh = 0once start = closeif(barindex>previousbar) thenpreviousbar=barindexhh=MAX(hh,high)var = (1-(start/hh))*100varmax = MAX(var,varmax)endifif(year<>year[1]) thenhh = 0varmax = 0start=closeendifRETURN varmaxYou can include this one in your ProScreener with a CALL instruction or copy/paste the code in it and get the “varmax” variable to achieve what you want to do. Hope it helps.
05/12/2016 at 10:36 PM #6938Hi Nicholas.
Thanks for your help.
The indicator calculates the max year performance since start of the year.
You code is really helpfull, i use it:
12345678once start = closeif(year<>year[1]) thenstart=closeendifRETURN ((close-start)/start)And i have performancesincestartofyear indicator.
Then, i try to create the screener.
12pssoy = call performancesincestartofyearSCREENER(pssoy as "close")But it doesn’t work. It gives nothing.
Can you help please?
Thanks.
Andrea
05/13/2016 at 8:39 AM #695505/13/2016 at 9:25 AM #6958Great Nicholas!
Thank you!
05/13/2016 at 9:29 AM #6959Mhh sorry
It give me close but i want to have perf in the screener.
05/13/2016 at 9:32 AM #6962I try this but don’t work.
12345678910once start = closeif(year<>year[1]) thenstart=closeendifperf = (close-start)/startSCREENER [1] (perf as "perf")05/13/2016 at 11:47 AM #698105/13/2016 at 2:20 PM #700512345678910once start = closeif(year<>year[1]) thenstart=closeendifperf = (close-start)/startSCREENER [perf] (perf as "perf")It doesn’t work!
05/13/2016 at 3:19 PM #7020I know why.. Because sometimes start=0 it creates a ‘division by zero’ error in ProScreener and then it stops and don’t give any results.
Here is the fixed code:
12345678910111213once start = closeif(year<>year[1]) thenstart=closeendifif start=0 thenstart=start[1]endifperf=((close-start)/start)SCREENER [1] (perf as "perf")05/13/2016 at 3:36 PM #702305/14/2016 at 12:18 PM #706007/09/2016 at 11:09 AM #10347The right code is:
12345678910111213once start = closeif(year<>year[1]) thenstart=close[1]endifif start=0 thenstart=start[1]endifperf=((close-start)/start)*100SCREENER [1] (perf as "performancedainizioanno")Previuos code don’t calculate first day of year.
I write it if someone need it.
Andrea
-
AuthorPosts
Find exclusive trading pro-tools on