Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (Ayumi, Quad, rki, 7th_zorro), 450 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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