Rank: Member
Groups: Registered, Registered Users Joined: 9/10/2006(UTC) Posts: 11
|
I have been learning MetaStock 9.0 for some weeks now and I am catching up on it.
I have some problems though.
I want a sell signal that only buys when the price hits, let's say one standard deviation lower than yesterdays close price.
How do I code that?
c> Cross(standard deviation)?
I have a feeling this is something that is very simple, but I got stuck.
thanks in advance.
|
|
|
|
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)
|
Magnus,
The code you need involves using:
Ref(C,-1) Stdev(C,someTimePeriod) Cross()
Have a look in the MS Users Manual for these, put them together in the right sequence. If you get stuck, post your code and we will help you sort it out.
wabbit [:D]
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 9/10/2006(UTC) Posts: 11
|
A Big thanks.
My only question here is the TimePeriod.
I have data from 2002-01-01 - 2006-09-19
I want all that data to be involved. What do I write the time period as?
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 9/10/2006(UTC) Posts: 11
|
Enter long position must then be:
c >Ref(C,-1)
Stdev(C,someTimePeriod)
Cross()
is this correct?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Posts: 1,346
|
hey magnus..... a sell signal that only buys , either that's a missprint or your talking about buying puts....
the standard devation needs a periods setting similar to a moving average needs a period setting.... you can use the input function for that..... it really has nothing to do with your amount of data available , other than you will need to have more data than the period setting of course..... but you have it now... the codes below will likely need to be changed as i'm having difficulty with the "sell signal that only buys" part......holler back in need be.....h
--------buy ?--------------
pds:=Input("standard deviation periods",1,100,10);
Cross(Ref(C,-1)- Stdev(C ,pds ),C);
----------------------
------------sell ?-------------------------
pds:=Input("standard deviation periods",1,100,10);
Cross(C,Ref(C,-1)- Stdev(C ,pds ));
---------------------------------------
|
|
|
|
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.