trade station 2000i code for EMS cross

leonard1

Junior member
Messages
10
Likes
0
hi
please help , can anyone help me with trade station 2000i code for 2 ema's cross ( to buy and sell when the 2 ema lines cross ).

thanking you
 
HI leo,

You should have a built in strategy for this within the tradestation. It might be for SMA, just open the strategy and copy the code to new strategy and then edit the line Average as XAverage.
If you still have trouble, here it is..

Code:
inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: FastAvg( 0 ), SlowAvg( 0 ) ;

FastAvg = XAverage( Price, FastLength ) ;
SlowAvg = XAverage( Price, SlowLength ) ;

If CurrentBar > 1 then begin
   if  FastAvg crosses over SlowAvg then
	Buy ( "XMA2CrossLE" ) next bar at market ;

   if  FastAvg crosses under SlowAvg then
               Sell ( "XMA2CrossSE" ) next bar at market ;
end;


Good Luck.
 
HI leo,

You should have a built in strategy for this within the tradestation. It might be for SMA, just open the strategy and copy the code to new strategy and then edit the line Average as XAverage.
If you still have trouble, here it is..

Code:
inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: FastAvg( 0 ), SlowAvg( 0 ) ;

FastAvg = XAverage( Price, FastLength ) ;
SlowAvg = XAverage( Price, SlowLength ) ;

If CurrentBar > 1 then begin
   if  FastAvg crosses over SlowAvg then
	Buy ( "XMA2CrossLE" ) next bar at market ;

   if  FastAvg crosses under SlowAvg then
               Sell ( "XMA2CrossSE" ) next bar at market ;
end;


Good Luck.

thank you Manigandan(y)
 
thank you Manigandan , it works great and congrats. on winning the cricket world cup.
 
Last edited:
Hi Leo,

You are welcome. Hope we deserve it to keep the world cup in our Nation. I am always Proud to be Indian.

:D
 
Hi Mani

i see on your profile that you are a trader.
im also a trader full time.
what do you trade?
 
Hi Mani

ok , so you just code the whole time. the firm you work for , if and what markets do they trade.
 
Top