indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Metastock

Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 27-12-2012, 05:46 PM
khatavkar99 khatavkar99 is offline
Newbie
 
Join Date: Dec 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
khatavkar99 is on a distinguished road
Thumbs up Kindly convert metastock formula in to the Amibroker AFL

Kindly convert above formula of metastock formula to amibroker AFL.

Formula is :-

{sell channel}
nd:= 2;
stobuy:=Cross(Stoch(5,3),20);
stosel:=Cross(80,Stoch(5,3));

c1:= Cum(1);
end:= LastValue(ValueWhen(1,stosel,c1));
date:= c1 = end;
time:= LastValue(end -
ValueWhen(1, date, ValueWhen(1, stobuy, ValueWhen(1, stosel, c1))))+1;
pt:=LastValue(ValueWhen(1,date,LinearReg(C,time))) ;
slope:=LastValue(ValueWhen(1,date,LinRegSlope(C,ti me)));
start:=BarsSince(Cum(1)>=end-(time-1));
center:=If(start=0,pt - (slope*(end-Cum(1))),0);
dis:= nd*LastValue(ValueWhen(1,date,STE( C, time)));
center+dis;
center;
center-dis



{buy channel}
nd:= 2;
stobuy:=Cross(Stoch(5,3),20);
stosel:=Cross(80,Stoch(5,3));

c1:= Cum(1);
end:= LastValue(ValueWhen(1,stobuy,c1));
date:= c1 = end;
time:= LastValue(end -
ValueWhen(1, date, ValueWhen(1, stosel, ValueWhen(1, stobuy, c1))))+1;
pt:=LastValue(ValueWhen(1,date,LinearReg(C,time))) ;
slope:=LastValue(ValueWhen(1,date,LinRegSlope(C,ti me)));
start:=BarsSince(Cum(1)>=end-(time-1));
center:=If(start=0,pt - (slope*(end-Cum(1))),0);
dis:= nd*LastValue(ValueWhen(1,date,STE( C, time)));
center+dis;
center;
center-dis

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 29-09-2013, 10:31 AM
AmiSmart AmiSmart is offline
Regular
 
Join Date: Sep 2013
Posts: 53
Thanks: 2
Thanked 79 Times in 37 Posts
AmiSmart is on a distinguished roadAmiSmart is on a distinguished road
Default

Originally Posted by khatavkar99 View Post
Kindly convert above formula of metastock formula to amibroker AFL.

Formula is :-

{sell channel}
nd:= 2;
stobuy:=Cross(Stoch(5,3),20);
stosel:=Cross(80,Stoch(5,3));

c1:= Cum(1);
end:= LastValue(ValueWhen(1,stosel,c1));
date:= c1 = end;
time:= LastValue(end -
ValueWhen(1, date, ValueWhen(1, stobuy, ValueWhen(1, stosel, c1))))+1;
pt:=LastValue(ValueWhen(1,date,LinearReg(C,time))) ;
slope:=LastValue(ValueWhen(1,date,LinRegSlope(C,ti me)));
start:=BarsSince(Cum(1)>=end-(time-1));
center:=If(start=0,pt - (slope*(end-Cum(1))),0);
dis:= nd*LastValue(ValueWhen(1,date,STE( C, time)));
center+dis;
center;
center-dis



{buy channel}
nd:= 2;
stobuy:=Cross(Stoch(5,3),20);
stosel:=Cross(80,Stoch(5,3));

c1:= Cum(1);
end:= LastValue(ValueWhen(1,stobuy,c1));
date:= c1 = end;
time:= LastValue(end -
ValueWhen(1, date, ValueWhen(1, stosel, ValueWhen(1, stobuy, c1))))+1;
pt:=LastValue(ValueWhen(1,date,LinearReg(C,time))) ;
slope:=LastValue(ValueWhen(1,date,LinRegSlope(C,ti me)));
start:=BarsSince(Cum(1)>=end-(time-1));
center:=If(start=0,pt - (slope*(end-Cum(1))),0);
dis:= nd*LastValue(ValueWhen(1,date,STE( C, time)));
center+dis;
center;
center-dis


Filename: Sell Channel.afl
PHP Code:
/****** Sell channel ******/
nd2;
stobuy=Cross(StochK(5,3),20);
stosel=Cross(80,StochK(5,3));

c1Cum(1);
endLastValue(ValueWhen(stosel,c1));
aDatec1 == end;
aTimeLastValue(end ValueWhen(aDateValueWhen(stobuyValueWhen(stoselc1))))+1;
pt=LastValue(ValueWhen(aDate,LinearReg(C,aTime))) ;
slope=LastValue(ValueWhen(aDate,LinRegSlope(C,aTime)));
start=BarsSince(Cum(1)>=end-(aTime-1));
center=IIf(start==0,pt - (slope*(end-Cum(1))),0);
disnd*LastValue(ValueWhen(aDate,StdErr(CaTime)));

Color colorRed;
Style styleDashed|styleNoLabel;

Plot(center+dis"Upper "+_DEFAULT_NAME(), ColorStyle);
Plot(center"Middle "+_DEFAULT_NAME(), ColorStyle);
Plot(center-dis"Lower "+_DEFAULT_NAME(), ColorStyle); 

Filename: Buy Channel.afl
PHP Code:
/****** Buy channel ******/
nd2;
stobuy=Cross(StochK(5,3),20);
stosel=Cross(80,StochK(5,3));

c1Cum(1);
endLastValue(ValueWhen(stobuy,c1));
aDatec1 == end;
aTimeLastValue(end ValueWhen(aDateValueWhen(stoselValueWhen(stobuyc1))))+1;
pt=LastValue(ValueWhen(aDate,LinearReg(C,aTime))) ;
slope=LastValue(ValueWhen(aDate,LinRegSlope(C,aTime)));
start=BarsSince(Cum(1)>=end-(aTime-1));
center=IIf(start==0,pt - (slope*(end-Cum(1))),0);
disnd*LastValue(ValueWhen(aDate,StdErr(CaTime)));

Color colorLime;
Style styleDashed|styleNoLabel;

Plot(center+dis"Upper "+_DEFAULT_NAME(), ColorStyle);
Plot(center"Middle "+_DEFAULT_NAME(), ColorStyle);
Plot(center-dis"Lower "+_DEFAULT_NAME(), ColorStyle); 

Last edited by AmiSmart; 29-09-2013 at 10:55 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to AmiSmart For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > Metastock


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 09:54 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2