Weekly High Low Open
Forums › ProRealTime English forum › ProOrder support › Weekly High Low Open
- This topic has 12 replies, 3 voices, and was last updated 5 years ago by Vonasi.
-
-
04/25/2019 at 1:07 PM #97115
Hello, I’m trying to get the last week’s high,low & open.
I tried it with this code, that works as an indicator, but if I use the graph functionality in ProRealCode, the levels are incorrect.
last weeks high,low,open12345678910111213141516171819202122232425x = abs(round(count[1]))+1highestWeek = highest[x](high)lowestWeek = lowest[x](low)openWeek1 = open[x-1]if openhour[1] <> openhour thendag = dayendifcount = count[1] + 1if dag <> dag[1] thennieuweDag = 1elsenieuweDag = 0endifif (dayofweek = 1 and nieuweDag) or (dayofweek[1] = 5 and dayofweek <> 5 and nieuweDag) thencount = 1highWeek = highestWeek[1]lowWeek = lowestWeek[1]openWeek = openWeek1endifreturn highweek,lowWeek,openWeekhow to get last week’s high,low and open in ProRealCode?
04/25/2019 at 1:18 PM #9711604/25/2019 at 1:27 PM #97117I just coded this (not tested):
12345678If OpenDayOfWeek = 1 and OpenDayOfWeek <> OpenDayOfWeek[1] thenopenWeek = openhighestWeek = 0lowestWeek = 999999EndifhighestWeek = max(highestWeek,high)lowestWeek = min(lowestWeek,low)return highweek,lowWeek,openWeek04/25/2019 at 2:43 PM #97125For some reason ProRealCode looks at other data or something. If I use your code the same happens as with mine; the levels are different. For example the high of 2 weeks ago in crude oil is 6350.2 instead of 6335.9 if I use the graph functionality in ProRealCode.
04/25/2019 at 3:08 PM #97129Do you have end-0f-day data?
In this case your data is one week old.
04/25/2019 at 3:10 PM #9713004/25/2019 at 3:25 PM #97133I’m guessing that it is different because week candles start on from a Sunday open and not on a Monday. This is why I used this in my indicators:
1if opendayofweek < opendayofweek[1] thenWith this Sunday open is used but if there is no Sunday or no Monday candle then Tuesday is used. It is very unlikely that one week ends on a Friday and the next trading candle is the next Friday so this should work fine.
04/25/2019 at 3:29 PM #97134Roberto and I noticed recently that in a strategy opendayofweek and dayofweek for a Sunday is the value 7 whereas in an indicator it is 0. Nicolas has reported it to PRT and we wait to see if they make some changes or whether we have to code around this.
04/25/2019 at 3:35 PM #97135That is not the problem, I use this part of your code:
Vonasi last week's open, high, low123456789101112131415161718192021222324252627if opendayofweek < opendayofweek[1] thenweekindex = weekindex + 1weekhigh = 0weeklow = closeweekopen = openif weekindex > 1 thenfor j = 1 to barindexif weekindex[j] = weekindex - 1 thenmyweekhigh = weekhigh[j]myweeklow = weeklow[j]myweekopen = weekopen[j]breakendifnextendifendifweekhigh = max(weekhigh,high)weeklow = min(weeklow,low)graph myweeklowgraph myweekhighgraph myweekopenIf you have a CFD account, you can look at the ‘last week’s high’, 2 weeks ago in US crude to see that it’s off
04/25/2019 at 3:47 PM #97136Try
1If OpenDayOfWeek = 7 and OpenDayOfWeek <> OpenDayOfWeek[1] thenbut as soon as at PRT they fix the issue it will change.
04/25/2019 at 3:54 PM #9713704/25/2019 at 4:03 PM #9713804/25/2019 at 4:07 PM #97139 -
AuthorPosts
Find exclusive trading pro-tools on