logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Leverage  
#1 Posted : Tuesday, May 14, 2013 5:34:36 PM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Hi guys,

Can Metastock plot Raff regression channel like in this pic?

Click here to see the pic

Tnx

wabbit  
#2 Posted : Tuesday, May 14, 2013 6:18:25 PM(UTC)
wabbit

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)
You can draw individual legs using the drawing tools.. to code will require the use of the MDK.



wabbit [:D]

Leverage  
#3 Posted : Wednesday, May 15, 2013 3:45:39 AM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Tnx wabbit,

so, if I try to code it with LRI? For example:

n:=Input("Periods LR:",2,100,14);
lr:=linearreg(C,n);
{calculate thrust distance since high and low value for n periods to lr}
hi:=HHV(H,n)-lr;
lo:=lr-LLV(L,n);
.....

how can I set the code to plot the band Gilbert Raff''s method? (bands are parallel and at max distance from high or low value for n periods considerated and LR).

I tried a logical sintax like:

ind:=If(hi>lo,lr+hi,lr+lo);
ind2:=If(hi<lo,lr-lo,lr-hi);
ind;ind2;lr;

but the result it's not satisfying. :(

Leverage  
#4 Posted : Wednesday, May 15, 2013 2:51:39 PM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

About previous post, I tried this:

Pds:=Input("Periods:",2,100,14);
Z:=LastValue(LinearReg(C,Pds));
Y:=LastValue(Cum(1))-Cum(1);
U:=Z-(LastValue(LinRegSlope(C,Pds))*Y);
R:=0-(LastValue(Cum(1))-Pds);
U+Ref(C,R)-Ref(C,R)

and this it's OK to plot linear regression trendline. Everyday updates itself changing slope.
It would be interesting to plot the Raff's channel method.

henry1224  
#5 Posted : Wednesday, May 15, 2013 3:41:45 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
dear Lev, didn't you read the warning about using LastValue in your trading systems?
Using LastValue, Metastock reads the chart from the extreme right edge and optimzes the value!
It Measures everything from the very last value from the right edge of the chart! You can't predict the future any better than flipping a coin!
There is no walk forward testing!Past performance doesn't mean anything. A system that gives tremendous resuts will never match those results in the future! A baseball player that hits 40 homeruns and is found out the he was on steriods, is not going to hit 40 homeruns the next season!If you find a player that hits 30 homeruns one season and 35 the next season, he is more likely to hit 40 homeruns this season than the guy who was on steroids! IE: ARod

Leverage  
#6 Posted : Wednesday, May 15, 2013 4:56:04 PM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Tnx henry for your precious reply...
it's not my intention predict the future with a flipping coin. My system is totally statistical based and my backtest is structured following fondamental rules of historic series.

My intention in this code is "to grab" prices through two bands with a good probability of seal.
Analizing with Excel the results of standard deviation, standard error and Raff regression, Raff channel is resulted the best to contain prices.

I simply looking for a method regression based to obtain this result...your note about MS is very precious for me :) my knowledge about MS are limited.

So...if you have a suggestion...you welcome! :)

henry1224  
#7 Posted : Wednesday, May 15, 2013 6:24:34 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Dear Lev,
Back to your code
Code:
U+Ref(C,R)-Ref(C,R)

without certain brackets, it seems that Ref(C,R)-Ref(C,R) sort of cancels out each other?
Leverage  
#8 Posted : Thursday, May 16, 2013 1:44:20 PM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

I think that it's better to use something like this (least square fit):

counter:=Cum(1)-pds;
y:=pds*Sum(counter*C,pds)
-Sum(counter,pds)*Sum(C,pds);
z:=pds*Sum(Pwr(counter,2),pds)
-Pwr(Sum(counter,pds),2);

but after some reflections about the issue, I believe that Raff regression isn't the best solution for a trading system. Standard error is better than Raff solution for my purpose.

Do you agree Henry?

P.S. My previous code is a very shame! I ask you don't consider it :(

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.