[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"sellshort" in TS4 easy language



PureBytes Links

Trading Reference Links

I'm trying to verify an indicator and it won't verify because of the
following words.  I'm supposing that the indicator was written with TS2000i
and I would like to know someone would help me translate this into TS4 easy
language.

"sellshort" is a word not recognized by easy language.  Below is the actual
usage(a part of the formula):

If Time > 1500 and Time < 1515 then begin
If Condition1 = True or Condition4 = true then Buy("LO-L") next bar at
Value2 stop;
If Condition2 = True or Condition5 = true then SellShort("LO-S") next bar at
Value3 stop;
End;


Another word not verifying is "buytocover". As in:

If Time = 1600 then
begin
Sell this bar on Close ;
Buytocover  this bar on Close ;
Condition1 = False;
Condition2 = False;
Condition4 = False;
Condition5 = False;
Condition6 = False;
Condition7 = False;
End;

Another one: "MarketPosition"...error is " position information function not
allowed in a study".  As in:

If Time > 1520 and Time < 1555 then begin
Condition6 = H[0] > H[1] and H[1] > H[2] and H[2] > H[3] and L[0] > L[1]
and L[1] > L[2] and L[2] > L[3];
Condition7 = H[0] < H[1] and H[1] < H[2] and H[2] < H[3] and L[0] < L[1]
and L[1] < L[2] and L[2] < L[3];
If MarketPosition(0) = 1 and OpenPositionProfit < 1 and Condition7 = true
then Sell next bar at L stop;
If MarketPosition(0) = -1 and OpenPositionProfit < 1 and Condition6 = true
then BuyToCover next bar at H stop;
End;

Without checking further I think "OpenPositionProfit" would probably also
generate the above error message.

The complete formula is attached.  It came from TradestationWorld.  Is it
possible to make this work in TS4?

John







{Here is my Strategy for trading the e-mini S&P in the last hour of trading. Set up 5 min bars. It is set up for the East Coast Time. If you are in another zone, you must adjust the code. What do you think?? (A work in progress)}
============================================================================
If Date <> Date[1] then begin
Value1 = Open ;
End ; 


If Time = 1500 then begin
Value2 = Highest(H,3);
Value3 = Lowest(L,3);
End;

If Time = 1500 then begin
If Value2 >= Value1 then Condition1 = True;
If Value3 <= Value1 then Condition2 = True;
Condition4 = H[0] > H[1] and H[1] > H[2] and H[2] > H[3] and L[0] > L[1] 
and L[1] > L[2] and L[2] > L[3];
Condition5 = H[0] < H[1] and H[1] < H[2] and H[2] < H[3] and L[0] < L[1] 
and L[1] < L[2] and L[2] < L[3];

End;


If Time > 1500 and Time < 1515 then begin
If Condition1 = True or Condition4 = true then Buy("LO-L") next bar at Value2 stop;
If Condition2 = True or Condition5 = true then SellShort("LO-S") next bar at Value3 stop;  {subs sellshort with sell}
End;
{=========================================================================================}

If Time = 1600 then
begin
Sell this bar on Close ;
Buytocover  this bar on Close ;  {subs buytocover with buy}
Condition1 = False;
Condition2 = False;
Condition4 = False;
Condition5 = False;
Condition6 = False;
Condition7 = False;
End;

If Time > 1520 and Time < 1555 then begin
Condition6 = H[0] > H[1] and H[1] > H[2] and H[2] > H[3] and L[0] > L[1] 
and L[1] > L[2] and L[2] > L[3];
Condition7 = H[0] < H[1] and H[1] < H[2] and H[2] < H[3] and L[0] < L[1] 
and L[1] < L[2] and L[2] < L[3];
If MarketPosition(0) = 1 and OpenPositionProfit < 1 and Condition7 = true then Sell next bar at L stop;
If MarketPosition(0) = -1 and OpenPositionProfit < 1 and Condition6 = true then BuyToCover next bar at H stop;
End;