It calculates the difference between 2.5 hour moving average (MA) and the current price, when the difference exceeds the threshold it buys:
![](https://developernote.com/wp-content/uploads/2021/08/image-51.png)
Bot parameters:
{
"amount": "10",
"marketId": "XRPUSDT",
"maxOrderCount": 5,
"maxPrice": "1.2155",
"orderCount": 1,
"testMode": false,
"threshold": "1.5"
}
Next day the bot continued to buy XRP (max -5% from MA):
![](https://developernote.com/wp-content/uploads/2021/08/image-52.png)
And the next day at 3:00AM:
![](https://developernote.com/wp-content/uploads/2021/08/image-53.png)