|
|
|
Tips and Tricks of Easylanguage
Tradestation Easylanguage is a powerful way to customize and test your trading ideas. By backtesting your trading ideas you can determine the return-to-risk ratio before you start trading. You can find more information about learning Easylanguage by looking at the Training and Education material where you will find references to TS Express and books to learn Easylanguage.
My system exits a trade and immediately reenters in the same direction. How do I keep it from reentering on the bar where the exit took place?
This is one of the most frequently asked questions. Tradestation does this because it has found a set of conditions on the bar prior to the exit that meet all the requirements for entering a trade on the next bar. The easiest way to prevent a reentry is to test to see if the system is in a trade before issuing the trading signal. For instance your code might look like this:
If condition1 = true and condition2 = true then buy market;
This code could be modified to check to see if it is already in a long trade before issuing a trading signal by using the marketposition reserved word. This word returns a value of 0 if the system is flat, a -1 if the system is short and a +1 if the system is long. Here is how to change the code:
If condition1 = true and condition2 = true and marketposition < 1 then buy market;
By adding the requirement that the marketposition must be less than 1, we are saying it is OK to take a trade as long as we are not already long. A similar modification must be made for short trades but you must check to see if marketposition is > -1.
|
|
|