I have tried to backtest and simulate my trading bot models to get results what they could achieve in the past.
At entry, every intervals, my bot would take 3 actions as following:
-
Take A Position (Long or Shot)
-
Place A Take Profit Order for 3%-change Stop Price
-
Place A Stop-Loss Order for 3%-change Stop Price
If Action 2 was fulfilled, the bot would cancel Action 3 and vice versa. If Action 3 was fulfilled, the bot would cancel Action 2.
This is what could happen based on the ‘/fapi/v1/klines’ api (OHLC) when we feed the one interval time of data:
Open: 100
High: 103
Low: 97
Close: 100
Supposedly, the bot took the short position at open time (for the price 100). Then the bot place Actions 2 and 3.
These are what it could happen:
First scenario is that the price then dropped to 97 then the bot fulfilled a take profit order and then cancel Action 3.
Second scenario is that the price then jumped to 103 then the bot fulfilled a stop-loss order and then cancel Action 2.
These scenarios lead to High/Low Sequence Possibilities that could affect the performance of bot-trading models.
Currently, I used only ‘/fapi/v1/klines’ to do backtesting; however, I am struggling with these two scenarios that could happend before or after another.
I was wondering if there is some logics or rules that could navigate the correct scenario when we do backtesting that could be addressed by any of Binance Future Market Endpoints APIs.
Thanks for trying to understand my problems. Hopefully someone have already solved these problems and can share the solutions.