number of periods
Forums › ProRealTime English forum › ProScreener support › number of periods
- This topic has 4 replies, 2 voices, and was last updated 10 months ago by LivJoJade.
-
-
01/24/2024 at 8:19 AM #226818
Good morning all
I have a proscreener in which I check various timeframes for the last 5 periods please see attached)
What I am wanting to do is check back over the overnight data, say the last 4 hours. Is it possible to code so that the 10 minutes checks 24 periods, the 5 minutes 48 periods etc etc without having to write the periods as follows [1] thru to [24] and [1] and [48], is it possible to place one line of code that ensures all the periods are checked?
s6 = (indicator6[1] < 0)
s7 = (indicator6[2] < 0)
s8 = (indicator6[3] < 0)
s9 = (indicator6[4] < 0)
s10 = (indicator6[5] < 0)Appreciate your help as always guys
Chris
01/25/2024 at 11:25 AM #226882Hi,
you can reach desired outcome by using the summation instruction to check how many times a condition was true over your chosen number N of candles. For example with N=24:
12345BasicCondition= (indicator6[1] < 0)N=24cN= (summation[N](BasicCondition)=N)For CN to equal 1 (true), this summation of BasicCondition over N candles must be equal to N, it necessarily means BasicCondition was true each time. Therefore with this example for N=24, you succeed checking this without writing 24 lines for each time.
You may be wondering “hey, but that’s only for indicator6[1], where are the others [2], … [24]?”, well it is for [1] as seen from each of the N candles, not as seen from current candle only, so it does cover the 24 occurences.
You can also write =(summation[24](BasicCondition)=24) if you prefer, using a separate variable N is not necessary, it’s just more convenient when you change the value. Also works this syntax: summation[24](indicator6[1]<0)=24
01/25/2024 at 8:52 PM #226893Hi JC Bywan
First of all many thanks for taking the time to offer your expertise.
If you take a look at the attached, if I have interpreted your instruction correctly then this screener attached should have delivered a number of signals on the GBP/EUR using the indicators also attached.
I’d appreciate any advise you are able to offer.
Many thanks in anticipation.
01/27/2024 at 2:29 PM #226942Hi,
Not fixing something, but just simplifying the screener code in its use of keyword “timeframe” and also avoiding unneeded duplicated calls by grouping them where the “ignored” are not needed : for example with first part of above file code about timeframe (5 minutes), this:
123456789101112131415TIMEFRAME(5 minutes)indicator6, ignored = CALL "123v2"[70, 30, 14](close)s6 = summation[48](indicator6[1]<0)=48TIMEFRAME(5 minutes)ignored, indicator8 = CALL "123v2"[70, 30, 14](close)b6 = summation[48](indicator8[1]>0)=48TIMEFRAME(5 minutes)indicator7, ignored = CALL "123 Bolly / RSI"[70, 30, 14](close)s7 = summation[48](indicator7[1]<0)=48TIMEFRAME(5 minutes)ignored, indicator9 = CALL "123 Bolly / RSI"[70, 30, 14](close)b7 = summation[48](indicator9[1]>0)=48can be written as:
12345678TIMEFRAME(5 minutes)indicator6, indicator8 = CALL "123v2"[70, 30, 14](close)s6 = summation[48](indicator6[1]<0)=48b6 = summation[48](indicator8[1]>0)=48indicator7, indicator9 = CALL "123 Bolly / RSI"[70, 30, 14](close)s7 = summation[48](indicator7[1]<0)=48b7 = summation[48](indicator9[1]>0)=48You can do the same kind of rewriting for the other timeframes in your screener .itf code.
If you obtain nothing out of the screener in your selected list, and know of at least one asset which should have been returned, after checking it does belong to selected list(s), you can visualise in an indicator derived from screener and applied to this asset all conditions s6 to s13 and b6 to b13 by having each one of them in the return line, to see which ones are true and which ones are not. And if one isn’t true when you thought it should be, you can find out why by looking at relevant indicatorX[1] series behaviour.
02/05/2024 at 7:38 PM #227437Hi JC Bywan
Apologies for not coming back to you sooner to say thank you but for some reason I couldn’t get any signals, I therefore played around with the code a little, for example….
summation[24](indicator6[1]<0)=24, this was delivering no signals until I removed the “=24” from the end, it then started to work.
Also this code delivered no signals…
TIMEFRAME(5 minutes)indicator6, indicator8 = CALL “123v2”[70, 30, 14](close)s6 = summation[48](indicator6[1]<0)=48b6 = summation[48](indicator8[1]>0)=48indicator7, indicator9 = CALL “123 Bolly / RSI”[70, 30, 14](close)s7 = summation[48](indicator7[1]<0)=48b7 = summation[48](indicator9[1]>0)=48So I reverted to the original. I may well be doing something clearly wrong, however the code is now working, I can look back much further and all seems to be working a treat.Many many thanks for your help and advise, I’m most grateful -
AuthorPosts
Find exclusive trading pro-tools on