Need help in converting Metastock code to Tradestation easylanguage

This is a discussion on Need help in converting Metastock code to Tradestation easylanguage within the TradeStation forums, part of the Trading Software category; Can somebody please help in converting this Metastock Code to Tradestation Easy Language. It is basically a trend following system. ...

Reply
 
LinkBack Thread Tools
Rookie
 
Join Date: Jul 2006
Posts: 13
amar_gr's Trading Profile
Need help in converting Metastock code to Tradestation easylanguage

Can somebody please help in converting this Metastock Code to Tradestation Easy Language.

It is basically a trend following system. The code generates a buy/sell on breakout above/below the 20 days range. For the exit/sar it plots the trailing stop loss.

Regards & Thanks in advance
Amar
--------
no:=Input("Swing/ Bars", 1, 20, 2);

res:=HHV(H,no);
sup:=LLV(L,no);
avd:=If(C>Ref(res,-1),1,If(C<Ref(sup,-1),-1,0));
avn:=ValueWhen(1,avd<>0,avd);
tsl:=If(avn=1,Ref(sup,-1),Ref(res,-1));

tsl;
amar_gr is offline   Reply With Quote
Senior Member
 
Join Date: May 2006
Posts: 198
Software vendor StratOpt's Trading Profile
Hopefully I understand the code right. Am not sure about what you term a trailing stop loss
So I am just putting in the standard TS dollar stop for trailing. This code does not take into account all conditions that might occur, but should serve as an example.

// Assuming daily chart
variables:
Amount ( 100 ) ; // Dollar amount of trailing stop

if close > Highest( high[ 1 ], 20 ) then Buy next bar market ;
if close < Lowest( low[ 1 ], 20 ) then SellShort next bar market ;

SetStopContract;
SetDollarTrailing( Amount ) ;

// Code does not prevent an immediate re-entry of position if conditions are still valid
// After a Trailing Stop has activated.
StratOpt is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easylanguage code help intradaybill TradeStation 6 Feb 25, 2008 7:57pm
Converting TradeStation Historical Data to wok in Metastock currency101 TradeStation 0 Dec 25, 2006 4:38am
Crash course in use Tradestation and EasyLanguage? bgold TradeStation 16 Sep 1, 2004 1:20pm
Converting data from Updata to Tradestation ilia king TradeStation 2 Feb 25, 2004 11:17am


New To Site? Need Help?


All times are GMT -4. The time now is 12:46pm.


Copyright © 2001-2009 Trade2Win Ltd