coding for previous period
Forums › ProRealTime English forum › ProScreener support › coding for previous period
- This topic has 14 replies, 4 voices, and was last updated 5 years ago by Nicolas.
-
-
04/22/2019 at 9:09 AM #96913
How do I code identify a previous periods close. So, I want my code to make reference to a previous periods candle etc.
Eg – Today Close > previous days close
04/22/2019 at 9:41 AM #96917If it is just daily close that you want then use DCLOSE[1] which is yesterdays close or DOPEN[1] . It is not possible to directly retrieve other values such as week close or year high for example but this recent indicator that I posted to the library might be useful to you if you want those values. Either hard code whichever section you need into a strategy or use CALL to get the values you need.
04/22/2019 at 9:58 AM #96919Unlikely common referencing of previous data, by means of brackets, DOPEN, DCLOSE, DHIGH and DLOW require parentheses to reference previous days.
04/22/2019 at 10:11 AM #96920DOPEN, DCLOSE, DHIGH and DLOW require parentheses
Well spotted Roberto. That is one that I always get wrong and PRT always tells me I got wrong! My previous post should read DCLOSE(1) and not DCLOSE[1].
04/22/2019 at 10:26 AM #96921Thanks guys, So I’ve been playing with the SUPERTREND TOUCH CODE from the forum which is:
1234ca1=low <= Supertrend[3,10]ca2=close > Supertrend[3,10]Screener[ca1 and ca2]I want to get it to look back at the previous periods close. So the codes reads:1234ca1=low <= Supertrend[3,10] //but less than previous period??ca2=close > Supertrend[3,10]Screener[ca1 and ca2]Im struggling04/22/2019 at 11:26 AM #96924Spider and The Fly – Please use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read. I have tidied up your post for you.
I will also move your topic to the screener forum as that is a more relevant place for it. 🙂
04/22/2019 at 11:30 AM #96926Thanks very much
04/22/2019 at 11:35 AM #9692704/22/2019 at 11:54 AM #9692904/22/2019 at 12:12 PM #96932Im sorry, I’m very new to code.’I cant work out how to do the PRT insert.
I want the close of yesterdays candle to be lower than the close of today’s candle. I don’t know how or where to put that in the original code listed below.
1234ca1=low <= Supertrend[3,10] //but less than previous period??ca2=close > Supertrend[3,10]Screener[ca1 and ca2]04/22/2019 at 12:28 PM #96933Please use the ‘Insert PRT Code’ button. I tidied up your post again!
As we are working in a screener we can use the TIMEFRAME instruction.
12345678timeframe(daily)ca3 = close > close[1]timeframe(default)ca1=low <= Supertrend[3,10] //but less than previous period??ca2=close > Supertrend[3,10]Screener[ca1 and ca2 and ca3]04/22/2019 at 1:00 PM #96934Im trying to get the screener to show the Supertrend when it flips bearish to bullish and vice versa as opposed to just recording a touch. Does that make sense?
04/22/2019 at 1:40 PM #96938Thanks very much guys. I’ve worked it out with your input. Much appreciated.
04/22/2019 at 1:58 PM #96940Im trying to get the screener to show the Supertrend when it flips bearish to bullish and vice versa as opposed to just recording a touch.
It might have been helpful if we’d had this information from the very beginning as it is very different to your first request! 🙂
04/22/2019 at 5:33 PM #96959 -
AuthorPosts
Find exclusive trading pro-tools on