Rank: Member
Groups: Registered, Registered Users Joined: 5/24/2005(UTC) Posts: 13 Location: Portugal
|
Hi again! First of all, thanks for the help I've been given.
The reason for this post...
Once I saw a guy who had his system implemented in Metastock and was able to say "to have a buy signal, the close has to be above x". How can this be done?
For example... in a Moving Average Crossover system (or any other), how can one know previously the value of close at which the MA's cross giving a signal.
Engenhus
|
|
|
|
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)
|
Well for most indicators its relatively simple.
Lets use the MA as an example.
If the value of Mov(C,10,S)=90 today and you want to know what the price will have to be tomorrow for the Mov(C,10,S) to be 100 then you just need to add up the last nine closing prices, Sum(C,9) and find the amount 'x' to add to make the ( Sum(C,9) + x ) / 10 = 100. Or in another way, Sum(C,9) + x = 1000, or the final result: x=1000 - Sum(C,9)
Exponential MA's use the similar process. If the value of Mov(C,9,E)=90 (using a 9 period MA which is equivalent to a nice round 20% EMA) and you want to know what price the close has to be tomorrow then 0.2*Mov(C,9,E)+0.8*x = 100, or x=( 100 - 0.2*Mov(C,9,E) ) / 0.8
If you want to get a little more complicated and work this for the RSI, then check out Jose's website for the answers.
Hope this helps.
wabbit :D
|
|
|
|
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)
|
I replaced your cumulate by the sum function in your post above, I hope that is correct :)
Thanks for the great explanation
Patrick :mrgreen:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Views messages in topic : 1,346
|
hey engenhus..... a couple thoughts here.... you can extend wabbit's code abit further to know the close needed today for 2 specific ma's to cross.... that way you could place a buy stop order at that price, if you trusted that type system.....
as an example the actual math to calculate the close needed today to give a collision of the 3 and 5 sma would be
c{needed}=1.5*Ref(C,-4)+1.5*Ref(C,-3)- Ref(C,-2)-Ref(C,-1)
you can test that easily in meta by creating an expert advisor and indicator.........
very roughly coded here for the 3 and 5 sma cross....
bullish
c>1.5*Ref(C,-4)+1.5*Ref(C,-3)- Ref(C,-2)-Ref(C,-1)
which should give similiar results to the better code Cross(Mov(C,3,S), (Mov(C,5,S)))
the major difference in the two would be in knowing tonite what the close must be tommorrow.....h
|
|
|
|
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)
|
Thanks Patrick,
Its either my seplling or my tpying!
LOL
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 5/24/2005(UTC) Posts: 13 Location: Portugal
|
Thanks for your posts. They've been a great help.
I mentioned MA's just as an example. I don't trust them very much... :wink:
I thought there would be another way, more straightforward. The guy I mentioned had a custom indicator composed by 10 "normal" indicators like ADX, RSI, CMO, etc. and he always knew what the closing had to be to have a buy/sell signal. It seem's preety hard to code this in that way.
Nevertheless, I appreciated very much your answers. Thanks. :wink:
|
|
|
|
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)
|
Have you considered exporting the price data into Excel and using the solver functions?
Just a thought.
wabbit :D
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 5/24/2005(UTC) Posts: 13 Location: Portugal
|
Actually I have, but I was considering using Matlab. I was trying to avoid having to code all the trading system outside Metastock but I see there is no other way.
Engenhus
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 7/6/2005(UTC) Posts: 5
|
This is my first post on this forum.
The predictive value for the Closing price for most indicators - as posed by Engenhus - is a simple matter of solving for "x" - ie. applying high school maths to solve an equation. The following code, when applied to a price chart, shows how far the Closing price has to move tomorrow, in order for the RSI to reach the values of 70, 50 and 30.
Similar indicators can be done for DMI, ADX, Stochastic etc.
[code:1:280bd2d419]a0:= Input("RSI Periods",3,34,5);
c1:= Input("Upper Level",10,90,70);
c2:= Input("50 Level",10,90,50);
c3:= Input("Lower Level",10,90,30);
a1:= CLOSE;
a2:= ROC(a1,1,$);
a3:= a2*(a2>0);
a4:= a2*(a2<0);
aa:= (PREV*(a0-1)+a3)/a0;
dd:= (PREV*(a0-1)+a4)/a0;
dd:= Abs(dd);
UL:= a1+(a0-1)*Max(dd*c1/(100-c1)-aa,dd-aa/(c1/(100-c1)));
MM:= a1+(a0-1)*Min(dd*(100/(100-c2)-1)-aa,dd-aa/(100/(100-c2)-1));
LL:= a1+(a0-1)*Min(dd*c3/(100-c3)-aa,dd-aa/(c3/(100-c3)));
UL;MM;LL;[/code:1:280bd2d419]
Regards Victor.
|
|
|
|
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.