Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 10/1/2005(UTC) Posts: 11
|
Dear all:
I need help to code this entry condition. Try many ways but still cant figure it out.
Say, my entry condition is A. And the current bar meet the entry condition. But, I won't enter the market yet. I will only enter the market when a Higher high of the current bar being hit within next 2 bars. In other words, buy signal will only hit when a move higher than the high of the current bar, for any bar within next 2 bars. I hope I address my question properly here.
Please help and thanx for any help.
B.D.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
Try this MS code:
[code:1:8220d5d23b]{ Initial setup signal example }
setup:=Cross(C,Mov(C,10,E));
{ Bars since setup signal }
setupCount:=BarsSince(setup);
{ High at setup signal }
setupHi:=ValueWhen(1,setup,H);
{ Entry }
entry:=H>setupHi AND setupCount<3;
{ Plot in own window }
setup*.5;entry
[/code:1:8220d5d23b]
jose '-)
http://www.metastocktools.com
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 10/1/2005(UTC) Posts: 11
|
Hi Jose:
Thanx for the wonderful codes. Can you please explain this line of code:
{ Plot in own window }
setup*.5;entry
What is the function of it? Why *0.5?
Thank you!
:D
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 10/1/2005(UTC) Posts: 11
|
Ok, Jose. Maybe that's only an example of your initial setup signal, right?
:lol:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
{ Plot in own window }
setup*.5;entry
The last line of MS code plots two signals: the original setup signal, and the final signal. This is done to help you verify that the MS code works as intended.
Plotting both signals together may get confusing, so I've just halved (*0.5) the setup signal for easier differentiation (sorry - I think I've just invented a new English word).
jose '-)
http://www.metastocktools.com
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 10/1/2005(UTC) Posts: 11
|
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 10/1/2005(UTC) Posts: 11
|
Sorry, Jose. I would like to consult you on a question on similiar scenario.
In this case, say, my LE condition is A, my LX is B, my SE is D and my SX is E. The current bar meet the LE condition. But, I won't enter the market yet. I will only enter the market when a Higher high of the current bar being hit, whether it is next bar or next 20bars as long as the LE signal is still valid.
The codes that I wrote has the 1 all the way - entry:=H>setupHi. I try to limit the all signals to only once. So is for SE. Lower Low of the signal bar. My LE, LX, SE, SX codes are rather long. I am not sure whether I can define that many variables under 1 indicator in MS. Thus, I have to define 4 indicators separetely for LE, LX, SE, SX.
Thank you for your time, Jose.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
|
|
|
|
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)
|
Thanks I really like the fanfare :D
But I would recommend you go to the downloads section to download the files unless you have metastock version 8.0 ...
Patrick :mrgreen:
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 10/1/2005(UTC) Posts: 11
|
Patrick wrote:Thanks I really like the fanfare :D
But I would recommend you go to the downloads section to download the files unless you have metastock version 8.0 ...
Patrick :mrgreen:
Hi Patrick:
I have MS 8. What can I do with it to solve my problem?
Thanx!
:shock:
|
|
|
|
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)
|
|
|
|
|
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.