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

Notification

Icon
Error

Options
Go to last post Go to first unread
Andrabr9  
#1 Posted : Monday, March 12, 2012 2:45:49 AM(UTC)
Andrabr9

Rank: Member

Groups: Registered, Registered Users
Joined: 3/10/2012(UTC)
Posts: 11

Was hoping someone could help me translate the tradestation code into Metastock code for an indicator and exploration for these two separate setups into an indicator and exploration... Var: Trend(False),TrendUp(False),TrendDn(False),FKBuy(False),FKSell(False); Trend = ADX(14) > 30; TrendUp = DMIPlus(14) > DMIMinus(14); TrendDn = DMIMinus(14) > DMIPlus(14); FKBuy = FastK(8) <= 40; FKSell = FastK(8) >= 60; If Trend and TrendUp Then Begin If FKBuy Then Buy("5DayMMBuy") High + .0625 Stop; ExitLong ("StopLossL") from entry ("5DayMMBuy") At$ Low[1] - .0625 Stop; If High < MaxTradeHigh then ExitLong; If Trend and TrendDn Then Begin If FKSell Then Sell("5DayMMShort") Low - .0625 Stop; ExitShort ("StopLossS") from entry ("5DayMMShort") At$ High[1] - .0625 Stop; If Low > MinTradeLow then ExitShort; End; end; the next separate setup is INPUT:ADXLEN(12),DMILEN(28),CUTOFF(30), ENTRYADD(1 POINTS); VAR:ADX12(0),DPLUS(0),DMINUS(0),HGAP(0),LGAP(0); ADX12=ADX(ADXLEN); DPLUS=DMIPLUS(DMILEN); DMINUS=DMIMINUS(DMILEN); HGAP=OPEN TOMORROW-H; LGAP=OPEN TOMORROW-L; IF ADX12>30 THEN BEGIN IF LGAP<0 AND DPLUS>DMINUS THEN BUY("ADX Gap Down") L+ENTRYADD STOP; IF HGAP>0 AND DPLUS<dminus THEN SELL("ADX Gap Up") H-ENTRYADD STOP; END; thanks
wabbit  
#2 Posted : Monday, March 12, 2012 5:17:40 AM(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)
Andrabr9 wrote:
Was hoping someone could help me translate the tradestation code
There are plenty of people here willing to HELP you if you put in some effort first; I don't think there are many who will do this for you. wabbit [:D]
henry1224  
#3 Posted : Monday, March 12, 2012 6:05:01 AM(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)
your code

FKBuy = FastK(8) FKSell = FastK(8) >= 60;

It doesn't seem that FastK has a specified level for the FKBuy
wabbit  
#4 Posted : Monday, March 12, 2012 5:25:15 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)
Henry,

The parsing used by the Community Server forum has borked the code at that specific point, but the code is still not complete regardless.



wabbit [:D]

Andrabr9  
#5 Posted : Tuesday, March 13, 2012 1:51:57 AM(UTC)
Andrabr9

Rank: Member

Groups: Registered, Registered Users
Joined: 3/10/2012(UTC)
Posts: 11

Thank you.I will read the Metastock manual over the weekend. I glanced at it and was somewhat intimidated. Maybe it is not as difficult as I thought. All the best Andy
Andrabr9  
#6 Posted : Tuesday, March 13, 2012 1:56:56 AM(UTC)
Andrabr9

Rank: Member

Groups: Registered, Registered Users
Joined: 3/10/2012(UTC)
Posts: 11

You are correct.. FKBuy = FastK(8) <= 40; FKSell = FastK(8) >= 60;
wabbit  
#7 Posted : Tuesday, March 13, 2012 2:10:47 AM(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)
Please use the proper code tags!

Code:

Var: Trend(False),TrendUp(False),TrendDn(False),FKBuy(False),FKSell(False);
Trend = ADX(14) > 30;
TrendUp = DMIPlus(14) > DMIMinus(14);
TrendDn = DMIMinus(14) > DMIPlus(14);
FKBuy = FastK(8) <= 40;
FKSell = FastK(8) >= 60;
If Trend and TrendUp Then Begin
 If FKBuy Then Buy("5DayMMBuy") High + .0625 Stop;
 ExitLong ("StopLossL") from entry ("5DayMMBuy") At$ Low[1] - .0625 Stop;
 If High < MaxTradeHigh then ExitLong;
 If Trend and TrendDn Then Begin
 If FKSell Then Sell("5DayMMShort") Low - .0625 Stop;
 ExitShort ("StopLossS") from entry ("5DayMMShort") At$ High[1] - .0625 Stop;
 If Low > MinTradeLow then ExitShort;
 End;
End;


Code:

INPUT:ADXLEN(12),DMILEN(28),CUTOFF(30), ENTRYADD(1 POINTS);
VAR:ADX12(0),DPLUS(0),DMINUS(0),HGAP(0),LGAP(0);
ADX12=ADX(ADXLEN);
DPLUS=DMIPLUS(DMILEN);
DMINUS=DMIMINUS(DMILEN);
HGAP=OPEN TOMORROW-H;
LGAP=OPEN TOMORROW-L;
IF ADX12>30 THEN BEGIN
IF LGAP<0 AND DPLUS>DMINUS THEN BUY("ADX Gap Down") L+ENTRYADD STOP;
IF HGAP>0 AND DPLUS <-- there is supposed to be more code here?!


The second code snippet is still incomplete.



wabbit [:D]

henry1224  
#8 Posted : Tuesday, March 13, 2012 6:30:08 AM(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)
Code:

DirOsc:=PDI(14) - MDI(14);
Trend:=If(ADX(14)>30 AND DirOsc>0,1,If(ADX(14)>30 AND DirOsc<0,-1,0));
FK:=((C - LLV(L,8))/(HHV(H,8)-LLV(L,8)))*100;
FKBuy:=Trend=1 AND FK<=40;
FKSell:=Trend=-1 AND FK>=60;
Lstop:=Ref(L,-1)+.0625;
Sstop:=Ref(H,-1)-.0625;
i:=Cum(FKBuy>-1 AND FKSell>-1)=1;
xL:=BarsSince(i OR FKBuy)<=BarsSince(i OR FKSell)=0;
xS:=BarsSince(i OR FKBuy)>=BarsSince(i OR FKSell)=0;
Sys:=XL-XS;
If(Sys=-1 AND L>Lstop,1,If(Sys=1 AND H<Sstop,-1,0));



You may want to change the stoploss Ref(L,-1)-.0625 Ref(H,-1)+.0625

I find that this system is a little whippy and have not tested it for total profit loss

Andrabr9  
#9 Posted : Tuesday, March 13, 2012 12:09:24 PM(UTC)
Andrabr9

Rank: Member

Groups: Registered, Registered Users
Joined: 3/10/2012(UTC)
Posts: 11

Thank you. I am not sure why it did not paste completely... INPUT:ADXLEN(12),DMILEN(28),CUTOFF(30), ENTRYADD(1 POINTS); VAR:ADX12(0),DPLUS(0),DMINUS(0),HGAP(0),LGAP(0); ADX12=ADX(ADXLEN); DPLUS=DMIPLUS(DMILEN); DMINUS=DMIMINUS(DMILEN); HGAP=OPEN TOMORROW-H; LGAP=OPEN TOMORROW-L; IF ADX12>30 THEN BEGIN IF LGAP<0 AND DPLUS>DMINUS THEN BUY("ADX Gap Down") L+ENTRYADD STOP; IF HGAP>0 AND DPLUS<dminus THEN SELL("ADX Gap Up") H-ENTRYADD STOP; END; I appreciate your help...thank you in advance
henry1224  
#10 Posted : Tuesday, March 13, 2012 12:26:05 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)
Code:

INPUT:ADXLEN(12),DMILEN(28),CUTOFF(30),

 ENTRYADD(1 POINTS);

 

VAR:ADX12(0),DPLUS(0),DMINUS(0),HGAP(0),LGAP(0);

 

ADX12=ADX(ADXLEN);

DPLUS=DMIPLUS(DMILEN);

DMINUS=DMIMINUS(DMILEN);

HGAP=OPEN TOMORROW-H;

LGAP=OPEN TOMORROW-L;

 

IF ADX12>30 THEN BEGIN

 IF LGAPDMINUS THEN BUY("ADX Gap Down") L+ENTRYADD STOP;

 IF HGAP>0 AND DPLUSEND;



The above code is still tradestation code
wabbit  
#11 Posted : Tuesday, March 13, 2012 4:33:01 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)
Andy, Use the proper code tags to post your code. How many times do I need to mention this? wabbit [:D]
Andrabr9  
#12 Posted : Wednesday, March 14, 2012 2:04:41 AM(UTC)
Andrabr9

Rank: Member

Groups: Registered, Registered Users
Joined: 3/10/2012(UTC)
Posts: 11

Thank you...I apologize, I am just learning again. I had Metastock in the early 1990s & however used another platform. I have a learning curve. I appreciate your help. Thanks
wabbit  
#13 Posted : Wednesday, March 14, 2012 2:36:48 AM(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)
Code:

INPUT:ADXLEN(12),DMILEN(28),CUTOFF(30), ENTRYADD(1 POINTS);
VAR:ADX12(0),DPLUS(0),DMINUS(0),HGAP(0),LGAP(0);
ADX12=ADX(ADXLEN);
DPLUS=DMIPLUS(DMILEN);
DMINUS=DMIMINUS(DMILEN);
HGAP=OPEN TOMORROW-H;
LGAP=OPEN TOMORROW-L;
IF ADX12>30 THEN BEGIN
 IF LGAP<0 AND DPLUS>DMINUS THEN BUY("ADX Gap Down") L+ENTRYADD STOP;
 IF HGAP>0 AND DPLUS<DMINUS THEN SELL("ADX Gap Up") H-ENTRYADD STOP;
END;
 



wabbit [:D]
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.