Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 5/3/2009(UTC) Posts: 2
|
I want to buy on a day when,
1. Open is higher than the high of yesterday, and
2. Close of yesterday is the lowerest in the last 5 days.
But the following codes listed in 'Buy Order' tab give incorrect results in System Tester, I am using Metastock 10.0.
REF(C,-1)=LLV(REF(C,-1),5)
AND
O>REF(H,-1)
Any help is appreciated.
Berdy
|
|
|
|
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)
|
Hi Berdy, Welcome to the forum. bertrandjyu wrote: 1. Open is higher than the high of yesterday
This is pretty simple and you have archived this with your code... not much more to say here. bertrandjyu wrote: 2. Close of yesterday is the lowest (sic) in the last 5 days.
This is a little more complicated. Do you mean: a) the CLOSE price yesterday is the lowest CLOSE price in the last five days from and including yesterday? b) the CLOSE price yesterday is a new lowest low CLOSE price in the last five days from and including yesterday? or c) the CLOSE price yesterday is the lowest CLOSE price in the last five days counted from the current bar? You have to be very specific about what you require as computers cannot interpret what you think you mean [:)] Anyway, here are my takes on what I think you might be trying to achieve? Code:
{a - equally low}
O > Ref(H,-1) and
ref(C <= llv(C,5), -1);
Code:
{b - new lower close}
O > Ref(H,-1) and
ref(C <= ref(llv(C,4),-1),-1);
Code:
{c - include today's bar}
O > Ref(H,-1) and
ref(C,-1) <= llv(C,5);
You might also want to consider adding some criteria to deal with today's CLOSE in relation to the lowest close in the period, e.g. can today also be an equally low CLOSE? Or, must the CLOSE today not be as low or lower? etc. Hopefully, one of these will be what you are looking for? If not, I hope they will give you the inspiration required to achieve your aim. wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 5/3/2009(UTC) Posts: 2
|
Hi wabbit
Thank you for your prompt reply. What I meant was case (b). Anyway, my code and your codes for case (a) (b) do not work for sample data MCD, which generate a incorerct BUY signal on 2006-05-19 .
I do not know why O > Ref(H,-1) fail to function in those formulae. Can you test them in your system?
Berdy
|
|
|
|
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)
|
Hi Berdy,
I don't have the original data as my data gets updated, and I don't have a buy signal on 19 May 2006. I do have signals correctly generated on 18 May 2006.
Please post an annotated chart with your signals and a description of why you think the signals are wrong, and perhaps another chart showing where you think the signals should be and why, and I am sure someone will find the time to have a look for you.
wabbit [:D]
|
|
|
|
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.