Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (TipmyPip, AndrewAMD, dBc, clonman), 18,621 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
N day high #482495
02/15/21 07:59
02/15/21 07:59
Joined: Jan 2021
Posts: 22
Singapore
S
strimp099 Offline OP
Newbie
strimp099  Offline OP
Newbie
S

Joined: Jan 2021
Posts: 22
Singapore
Greetings,

How can I determine if yesterday's close price is the rolling 50 day high? This is what I tried so far

Code

vars Prices = series(priceClose())
var Max50Day = MaxVal(series(priceClose()+1),50);

if (equalF(Max50Day, Prices[1]))
{
    // do stuff
    printf("\n%f %f %f",Max50Day, Prices[1], equalF(Max50Day, Prices[1]));
}


When I run this, I'm entering the IF statement on every iteration even though equalF(Max50Day, Prices[1]) evaluates to 0.000.

I've also tried the following in the IF expression

Code
if (Prices[1] >= Max50Day)


Which only matches once in 16 years worth of SPY daily close history (?).

Last edited by strimp099; 02/15/21 08:53.
Re: N day high [Re: strimp099] #482521
02/17/21 13:17
02/17/21 13:17
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
The "+1" is wrong - you're this way adding 1 to all prices. But the second if expression is ok.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1