Error in Highest[n](high)
Forums › ProRealTime English forum › ProBuilder support › Error in Highest[n](high)
- This topic has 11 replies, 2 voices, and was last updated 8 years ago by Adolfo.
-
-
04/24/2016 at 4:02 PM #5899
Hi everyone!
I’m getting this error when trying to set up one variable at Highest.
12345678910111213141516171819202122REM Reset Januaty 1stlastyear = year-year[1]IF lastyear>=1 thenmaximo = Dopen(0)minimo = Dopen(0)velaapertura = Barindexendifvelaactual = Barindexn=velaactual-velaapertura // 1,2,3...etc.IF Close>maximo thenmaximo=Highest[n](high)contador=contador+1endifIF Close<minimo thenminimo = Lowest[n](low)contador=contador-1endifreturn contadorIf I set up n=1,2,3… etc is working ok.
Result of “n” calculation is 1,2,3.. but getting this error alert: “Integer positive expected on HIGHEST”
Any ideas?
04/24/2016 at 5:18 PM #590104/24/2016 at 6:24 PM #5902Thanks Nicolas, I tryed different ways to calculate “n”.
1n=abs(velaactual-velaapertura) // 1,2,3...etc123n=velaactual-velaapertura// ORn=velaapertura-velaactualGetting the same error in all cases, it says that “n” should be an integer positive.
Return n is showing 1,2,3… so… is an integer, is positive… I can’t get the point :/Cheers!
04/24/2016 at 6:28 PM #590304/24/2016 at 6:37 PM #5904Yes, you are right! but still the same.
1velaapertura=Barindex-1At this point first result is 1 instead 0, but still the same error, here the code updated:
12345678910111213141516171819202122REM Reset Januaty 1stlastyear = year-year[1]IF lastyear>=1 thenmaximo = Dopen(0)minimo = Dopen(0)velaapertura = Barindex-1endifvelaactual = Barindexn=velaactual-velaapertura//n=5 //IF Close>maximo thenmaximo=Highest[n](high)contador=contador+1endifIF Close<minimo thenminimo = Lowest[n](low)contador=contador-1endifreturn contador04/24/2016 at 7:43 PM #5911Just tried to solve this issue. I’m stuck here too 🙂 Sunday evening you know …
In intraday your n variable still returns negative values though.
Maybe you could explain me better what you want to do with this code? I would be more helpful!
04/24/2016 at 8:14 PM #5915Thanks Nicolas!
I wanna set “n” as the result of the current bar minus the first bar (in this case January 1st bar) so, in January 15th the result of (n=currentbar-firstbar) should be “15” and set “n” (Highest[n](high) or Lowest[n](low) as 15.
The point here is to get the maximum and minimum prices of the current year from variables Highest and Lowest. But.. Maybe there is a short and easy way to find this, Like Dhigh…. I’m confused also…
Thanks a lot again for your time Nicolas.
04/25/2016 at 7:42 AM #5922Oh I see now 🙂
Is this what you are trying to do? :
1234567891011121314once hh = highonce ll = low//reset each yearif year<>year[1] thenhh = highll = lowendif//which value is max or min?hh = MAX(hh,high)ll = MIN(ll,low)RETURN hh,ll04/25/2016 at 11:01 AM #593304/25/2016 at 11:05 AM #593604/25/2016 at 11:39 AM #593806/03/2016 at 10:16 AM #8713Finally I thinkl I know what the problem is, and with your help and working together with RICHARDYUSTE, we realize we were getting “0” as first result, that was the problem. First result is “1” but Barindex was “0” sometime… Seems to be ok now. 🙂
Best trading ever 🙂
-
AuthorPosts
Find exclusive trading pro-tools on