Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, howardR, sleakz), 674 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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