Price · condition block
Price move
The price move block compares the latest close with the close a fixed number of candles earlier and fires when the change is at least the percentage you set. It is the simplest way to say "buy the dip" or "sell the rip".
How the engine evaluates it
On every candle close the engine takes the close N candles back and works out the percentage change to the current close. up fires when the change is at least +X%; down fires when it is at most −X%.
Only those two closes are compared. What happened in between (a spike, a crash and recovery) does not matter, so a move of exactly the same size can come from very different paths.
N counts candles, not hours: in 24 means one day on 1-hour candles but four days on 4-hour candles. If fewer than N earlier candles exist, the block is false.
change % = (close[now] − close[N candles ago]) / close[N candles ago] × 100
up: change % ≥ X
down: change % ≤ −X
Botscript syntax
In the Lab you pick this block from the Price group and fill in its fields. In the code view the same condition is written like this:
price down 3% in 24
price up 5% in 48
Settings
| Setting | Values | Default | Notes |
|---|---|---|---|
| Direction | up, down | down | Which way the price must have moved. |
| Percent | 0 – 10,000 | 3% | The minimum size of the move. |
| Lookback | 1 – 5,000 candles | 24 | How many candles back the comparison close is. |
| Timeframe | the run's candles, or 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1w | the run's candles | Optional. At least the run's candle size and a whole multiple of it. |
On a higher timeframe
Add a timeframe at the end to read Price move from bigger candles than the run uses, for example price down 5% in 6 on 1d. The engine builds those candles from the run's own candles (UTC, weeks start on Monday) and evaluates the block only on candles that have closed, so there is no look-ahead. Lengths and lookbacks count the bigger candles.
Price move is a state on a higher timeframe: the result from the last completed bigger candle holds on every run candle until the next one closes.
The timeframe must be at least the run's candle size and a whole multiple of it; otherwise the run stops with an error and is not charged. Multi-timeframe conditions covers the details, including warm-up.
How traders use it
- Dip buying:
price down 3% in 24as an entry, often with an RSI or trend filter so you are not buying a falling knife. - Momentum entries:
price up 5% in 48to join a move that is already under way. - Simple exits:
price up 8% in 72withholdingto sell into strength. - Crash protection:
price down 10% in 24withsell 100%as a blunt emergency exit.
Example bot
bot "Dip Buyer"
when price down 3% in 24 and cooldown 12
then buy 50%
when price up 5% in 24
then sell 100%
- Rule 1 buys with half the available cash when the close is at least 3% below the close 24 candles ago, but only if 12 candles have passed since the last trade.
- Rule 2 closes the whole position after a 5% rise over the same window.
Pitfalls
- The block stays true on every candle while the move lasts. Without a cooldown or a position check it will try to act again and again (buys are ignored while you already hold, unless stacking is on).
- A 3% move means something very different on 5-minute and daily candles. Re-tune the percentage when you change candle size.
- Tuning the percentage and lookback until a backtest looks perfect is curve fitting. Check that nearby values behave similarly.
Price move: frequently asked questions
Does "price down 3% in 24" mean the price fell 3% at any point in the last 24 candles?
No. It compares two closes only: the current close and the close exactly 24 candles earlier. A drop that recovered before the current close does not count.
Is the lookback measured in hours or candles?
Candles. The same rule covers one day on 1-hour candles and four days on 4-hour candles, so change the number when you change the candle size.
Why does my bot not buy every time the block is true?
By default a bot holds one position at a time, so further buys are skipped until it sells. Turn on stacking in the risk guards to allow adding to a position.
Can I use decimals in the percentage?
Yes. price down 1.5% in 12 is valid.
Related blocks
Simulated results are hypothetical. They include only the fee and slippage you set on the bot, not every real-world cost or market condition, and past performance does not guarantee future results. Nothing here is financial advice.