Stock Predictor trading strategy

%Gain – Loss Filter

This strategy uses only the closing price and fixed percentages. It buys when the price has fallen a percent from its highest close of the last n days.

Strategy group
Price, volatility and time filters
Based on
Closing price
Typical parameters
n days, a %, b %, p %

After the buy it sells when the price has gained b percent, or, if the price keeps falling, when it is p percent below the buying price (stop loss).

Trading signals

  • Buy when the close is a% below the highest close of the last n days.
  • Sell when the close is b% above the last buying price.
  • Stop loss: sell when the closing price falls p percent below the last buying price.

Strategy rules

IF C(t) < (1 - a/100) * MAX{ C(t ... t-n) }
   THEN GO LONG
IF C(t) > (1 + b/100) * BUY_PR
   THEN SELL
IF C(t) < (1 - p/100) * BUY_PR
   THEN SELL

Where C(t) is the closing price. BUY_PR is the last buying price and p is the stop-loss percentage.

Test it in Stock Predictor. Select %Gain – Loss Filter on the Strategies tab, set the parameters and run the strategy on one stock or a whole group. Pair it with another strategy in a combined strategy.

Backtest results describe past prices and do not guarantee future results. See our disclaimer.