Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, alibaba, Quad), 761 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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