Discussions
»
Product and Service Development
»
Formula Assistance
»
close breaks the high of the first trading hour [RESOLVED]
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 6/30/2005(UTC) Posts: 71
|
I want the metastock formule of this:
I want to go long if the close breaks the high of the first trading hour (on a 5minchart)
I want 1 trade a day so when this trade is over it can't go long or short till next day.
hope someone here can help me.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
What time is the first hour on your chart?
For example the first hour is from 8am to 9am I would write for your buy ...
ST:=Highestsince(1,Hour()=8 and Minute()=0,H);
HV:=Valuewhen(1,Hour()=9 and minute()=0,ST);
Cross(C,HV)
Patrick :mrgreen:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 6/30/2005(UTC) Posts: 71
|
great, thank you
edit..just tested it, but it won't give any signals
edit..my faultm, it works but sometimes it gives multiple trades in a day..how can I make it like it's maximum does 1 trade a day?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
Try something like:
ST:=Highestsince(1,Hour()=8 and Minute()=0,H);
HV:=Valuewhen(1,Hour()=9 and minute()=0,ST);
Signal:=Cross(C,HV);
Signal and Barssince(ref(Signal,-1))>barssince(hour()=9 and minute=0)
Patrick
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 6/30/2005(UTC) Posts: 71
|
we are almost there, tnx again, ik wont give 2 long signals now, that is good..but If I also want short signals in there with
ST2:=Lowestsince(1,Hour()=8 and Minute()=0,L);
HV2:=Valuewhen(1,Hour()=9 and minute()=0,ST2);
Signal:=Cross(HV2,c) and hour() >=9;
Signal and Barssince(ref(Signal,-1))>barssince(hour()=9 and minute()=0)
It can give a long and short signal on 1 day..is there a code that if there already was a long signal that short signals will be ignored?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
{Enter Long}
ST:=Highestsince(1,Hour()=8 and Minute()=0,H);
HV:=Valuewhen(1,Hour()=9 and minute()=0,ST);
Signal:=Cross(C,HV);
ST2:=Lowestsince(1,Hour()=8 and Minute()=0,L);
HV2:=Valuewhen(1,Hour()=9 and minute()=0,ST2);
Signal2:=Cross(HV2,c) and hour() >=9;
Signal and Barssince(ref(Signal,-1))>barssince(hour()=9 and minute=0)
and Barssince(ref(Signal2,-1))>barssince(hour()=9 and minute=0)
{Enter Short}
ST:=Highestsince(1,Hour()=8 and Minute()=0,H);
HV:=Valuewhen(1,Hour()=9 and minute()=0,ST);
Signal:=Cross(C,HV);
ST2:=Lowestsince(1,Hour()=8 and Minute()=0,L);
HV2:=Valuewhen(1,Hour()=9 and minute()=0,ST2);
Signal2:=Cross(HV2,c) and hour() >=9;
Signal2 and Barssince(ref(Signal2,-1))>barssince(hour()=9 and minute=0)
and Barssince(ref(Signal,-1))>barssince(hour()=9 and minute=0)
Patrick :mrgreen:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 6/30/2005(UTC) Posts: 71
|
ok, I think this is exactly what I meant..thanks again. Must say I didn't know the service of equis was this good till today. I learn't alot today from the codes you posted here and the video's I watched today. Thank you for doing all this. I appreciate it a lot
gr BB
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 6/30/2005(UTC) Posts: 71
|
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
No problem :D
Hey g, I have to say you clean up post nicely. Keep up the good work :D
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
close breaks the high of the first trading hour [RESOLVED]
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.