logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
wdgigi  
#1 Posted : Sunday, February 15, 2009 11:46:10 AM(UTC)
wdgigi

Rank: Member

Groups: Registered, Registered Users
Joined: 3/6/2008(UTC)
Posts: 16

Goodmorning,

this is the code written by Wabbit for the hurst's cycle. But now i would start this cycle for an intraday chart on an specific time. I've tried with this input (Hr:=Input("Hours [0-23]",0,23,9);Mn:=Input("Minutes [0-59]",0,59,30);) but it doesn't work.

Thanks for helping me.

gg

This the original code:

****************************************************************************

{coded for WDGIGI, 03 June 2008}

{copyright 2008, Scott Bunny}

D:=Input("Day of month",1,31,1);

M:=Input("Month",1,12,1);

Y:=Input("Year",1900,2100,2008);

Hr:=Input("Hours [0-23]",0,23,9);

Mn:=Input("Minutes [0-59]",0,59,30);

WA2:=3;

wavelength:=Input("Wavelength (bars)",1,9999,243);

{bars}

start:=Cum((DayOfMonth()=D AND Month()=M AND Year()=Y) OR

(DayOfMonth()>=D AND Month()=M AND Year()=Y) OR

(Month()>M AND Year()=Y) OR

Year()>Y)=1;

start:=LastValue(ValueWhen(1,start,Cum(1 )));

{x axis values}

x:=360/wavelength * (Cum(1)-start);

{sine waves}

phase:=-90;

w1:=Sin(8*x+phase);

w2:=2*Sin(4*x+phase);

w3:=wa2*Sin(2*x+phase);

w4:=4*Sin(x+phase);

{hurst cycle}

CYCLE:= (W1+W2+W3+W4);

basso:=LastValue(ValueWhen(1,cycle,Lowest(cycle)));

alto:=LastValue(ValueWhen(1,cycle,Highest(cycle)));

Grc:=(alto-basso)/486;

{plot}

CYCLE;

*****************************************************************************

wabbit  
#2 Posted : Sunday, February 15, 2009 6:31:37 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Boy, how much do I like editing my own codes? Especially after someone else has been at it too!

You cannot just get the user to Input() information without doing something with it. You have the car, you have the car-keys, now you have to do something with them. One is useless without the other. You needed to amend the "start" variable to consider the time information as well as the existing date information.

Code:

{coded for WDGIGI, 03 June 2008}
{edited at MetaStock Online Community, 16 February 2009}
{copyright 2008, Scott Bunny}

D:=Input("Day of month",1,31,1);
M:=Input("Month",1,12,1);
Y:=Input("Year",1900,2100,2008);
Hr:=Input("Hours [0-23]",0,23,9);
Mn:=Input("Minutes [0-59]",0,59,30);

wavelength:=Input("Wavelength (bars)",1,9999,243);

{amplitude adjustments?}
wa2:=3;

{bars}
start:=
Cum(
(Minute()>=Mn AND Hour()=Hr AND DayOfMonth()=D AND Month()=M AND Year()=Y) OR
(Hour()>Hr AND DayOfMonth()=D AND Month()=M AND Year()=Y) OR
(DayOfMonth()>D AND Month()=M AND Year()=Y) OR
(Month()>M AND Year()=Y) OR
Year()>Y
)=1;

start:=ValueWhen(1,start,Cum(1));

{x axis values}
x:=360/wavelength*(Cum(1)-start);

{sine waves}
phase:=-90;
w1:=Sin(8*x+phase);
w2:=2*Sin(4*x+phase);
w3:=wa2*Sin(2*x+phase);
w4:=4*Sin(x+phase);

{hurst cycle}
cycle:= (w1+w2+w3+w4);

{these aren't used?}
basso:=LastValue(ValueWhen(1,cycle,Lowest(cycle)));
alto:=LastValue(ValueWhen(1,cycle,Highest(cycle)));
grc:=(alto-basso)/486;

{plot}
cycle;



wabbit [:D]



wdgigi  
#3 Posted : Monday, February 16, 2009 12:48:26 AM(UTC)
wdgigi

Rank: Member

Groups: Registered, Registered Users
Joined: 3/6/2008(UTC)
Posts: 16

this is. So simple...:-))

***************************************************************************

{coded for WDGIGI, 03 June 2008}
{edited at MetaStock Online Community, 16 February 2009}
{copyright 2008, Scott Bunny}

D:=Input("Day of month",1,31,1);
M:=Input("Month",1,12,1);
Y:=Input("Year",1900,2100,2008);
Hr:=Input("Hours [0-23]",0,23,9);
Mn:=Input("Minutes [0-59]",0,59,30);

wavelength:=Input("Wavelength (bars)",1,9999,243);

{amplitude adjustments?}
wa2:=3;

{bars}
start:=
Cum(
(Minute()>=Mn AND Hour()=Hr AND DayOfMonth()=D AND Month()=M AND Year()=Y) OR
(Hour()>Hr AND DayOfMonth()=D AND Month()=M AND Year()=Y) OR
(DayOfMonth()>D AND Month()=M AND Year()=Y) OR
(Month()>M AND Year()=Y) OR
Year()>Y
)=1;

start:=ValueWhen(1,start,Cum(1));

{x axis values}
x:=360/wavelength*(Cum(1)-start);

{sine waves}
phase:=-90;
w1:=Sin(8*x+phase);
w2:=2*Sin(4*x+phase);
w3:=wa2*Sin(2*x+phase);
w4:=4*Sin(x+phase);

{hurst cycle}
cycle:= (w1+w2+w3+w4);

{these aren't used?}
basso:=LastValue(ValueWhen(1,cycle,Lowest(cycle)));
alto:=LastValue(ValueWhen(1,cycle,Highest(cycle)));
grc:=(alto-basso)/486;

{plot}
cycle;

****************************************************************************

wdgigi  
#4 Posted : Monday, February 16, 2009 12:55:28 AM(UTC)
wdgigi

Rank: Member

Groups: Registered, Registered Users
Joined: 3/6/2008(UTC)
Posts: 16

thx wabbit!
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.