Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2006(UTC) Posts: 33
|
I utilize the formula (If(-Cross(Mov(MACD(),9,E),0),1,0)) to indicate a buy.
I want to create an expert that tells me to buy one day later and then alerts me when the price is 10% above or 10% below on an EOD chart.
In other programming languages (Basic) I would say something like this to identify the day:
if (If(-Cross(Mov(MACD(),9,E),0),1,0)) =1 then
bdate =date()
bPrice = Close
end if
then I would go through each day from that date to examine the price (in this case the close):
Sell = false
if date() > bdate and close >= bprice *1.1 then
Sell = true
end if
That's how my brain has been wired up till now. I need to rewire it for Metastock, can someone help?
|
|
|
|
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)
|
jer, See http://forum.equis.com/forums/thread/20672.aspx on latching exit criteria to the entry price. Also if(If(-Cross(Mov(MACD(),9,E),0),1,0)) =1 is more simply written as: Cross(Mov(MACD(),9,E),0) which will return a value of 1 (true) or 0 (false) , so you do not need to use the if(criteria,1,0) code section. I envisage something along these lines might help: Code:
Entry:=Cross(Mov(MACD(),9,E),0);
Tr:=
If(PREV=0,
If(Ref(Entry,-1),OPEN,0), {buy on open on the next bar}
If(C>(0.9*PREV) OR C>(1.1*PREV), 0,{PREV is the entry price}
PREV));
{plot}
Tr;
This is NOT fast but it should show you some way to solve your issue.. wabbit [:D] P.S. This is the third latching question on the Forum in the past few days... why the sudden rush? and why aren't members reading the other posts? [:confused]
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2006(UTC) Posts: 33
|
Thanks Wabbit
In regards to the PS, I can shed light on why I didnt see the other posts:
1) Didn't know it was called "Latching"
2) Not use to the search function working yet [:)] Took me a while to get use to it not working, now that everything is great, it wll take a while.
3) I'm old (seems to work in quite a few situations. I deserve it)
Thanks again
Jerry
|
|
|
|
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)
|
jer99 wrote:In regards to the PS, I can shed light on why I didnt see the other posts:
1) Didn't know it was called "Latching"
2) Not use to the search function working yet Took me a while to get use to it not working, now that everything is great, it wll take a while. You can keep up-to-date with all the goings on at the Forum be reading, not each individual board, but the active message threads by using the link http://forum.equis.com/forums/TopicsActive.aspx
|
|
|
|
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.