If you click on BUYSTOP in the list of actions, the description appears "Buy to Exit Short Position". This rule action is normally used as a stop loss rule to buy (cover) the short position if the market rises against you above some level. For example, you can have a BUYSTOP rule with the signal formula CL > ENTRY * 1.05; This would exit the short position if the price of the stock rose more than 5% higher than the price at which you shorted.
Investor/RT only tests BUYSTOP rules when the trading system is short. Similarly, SELLSTOP rules sell to exit a long position if the market falls below some level after you open the position.
Investor/RT tests each trading rule from top to bottom for each bar, skipping over those rules that do not apply. Thus BUYSTOP rules are skipped when the backtest is either out of the market or when the system is in a long position. SELLSTOP rules are skipped unless the backtest is in a long position. BUY and SELLSHORT rules are tested only when the trading system is out of the market.
CONFIRM rules are special. If a CONFIRM rules signals true, the rule following the CONFIRM rules is tested to confirm the signal and the action of that next rule determines what is done. You can have a series of CONFIRM rules leading up to a BUY or SELL action or whatever. When a CONFIRM rule tests false, the next rule is skipped altogether. If you have a series of CONFIRM rules and anywhere down the line one of them signals FALSE, the whole series of remaining CONFIRM rules is skipped, including the final rule beneath the last CONFIRM rule in the sequence, and rule testing continues. Once all of the rules in the backtest have been tested for the bar, the system moves on to the next bar and rule testing begins again at the top of the rule list.
The order of rules is important. If you are testing a long system and you put your SELLSTOP stop loss rule after your BUY rule, as soon as you go long, the SELLSTOP rule will be tested on the same bar at which you entered the long position. Putting the SELLSTOP rule above the BUY rule means that the SELLSTOP rule will be ignored until the bar after the system goes long.
You can use V# variables to keep track of either a fixed or dynamic stop loss level, or you can use the built-in variable named STOP to implement trailing stops. The value of STOP can be SET just like a V# variable, however, when a SET statement sets STOP, IRT will not set a value into this variable unless the value is higher than before (when you are long). In other words, when you are long, SET(STOP, ...) statements cannot lower the stop only raise it. The reverse is true when the system is short, namely, the STOP can only be lowered by a SET statement. STOP is always zero when you first enter a new position. Include a rule like SET(STOP, CL * .95) to set the stop 5% below the current price (long case). If the market goes up the STOP will keep increasing but once lower closes begin to happen, the stop will not be lowered and eventually, a SELLSTOP rule with the formula CL
BUY rules can only initiate a new long position. BUYMORE rules are tested only when the backtest is already long. If true, a BUYMORE rule can add to the position, subject to the limitation on position size specified in the backtest setup page.
SELLSHORT rules initiate short positions. SELLMORE rules can add to the short position (sell short more).
We designed the BUY/BUYMORE and SELLSHORT/SELLMORE actions to make it easier to design trading systems and add to the long or short position once the initial position is established. Once the system is long, BUY rules are skipped, but BUYMORE rules are tested. Similar, once you are short, SELLSHORT rules are skipped but SELLMORE rules, if present, are tested.