Comments (3)
I've removed the typo, still need to fix trailing stop in the back tester seems to result in inflated profits the logic is messed up somehow.
from binance-futures-trading-bot.
I've got idea why profits are inflated or maybe even deflated. I see that in backtester is calculation if SL, TP, TSL is triggered based on candle close. This might be issue because if you look on candles there are swings up and down. In real time data those swings could trigger either SL or TP/TSL but in backtest will not because are not catched. Considering 1 minute candle as you do in backtest was great idea and it make good precision for calculation. What can make it even more precise is to consider also 1 minute candle High and Low values for decision if SL, TP, TSL was triggered or not .. Let see example:
takeprofitvalue = 0.2
entry_price = 4.3
take_profit_price = 4.3 +0.2 = 4.5
backtest 1 minute candle close = 4.49 - in backtest this will not be considered / calculated as TP triggered.
real situation:
backtest 1 minute candle high = 4.51 - which should trigger TP but in backtest will not
This can be solved with:
LONG POSITION
TP condition: High >=TP instead of Close >= TP or
SL condition: Low <= SL instead of Close <= SL
Same goes for opposite way.
Issue here is how to decide which swing was first .. either Low or High but this is irrelevant in case that you are not doing backtest for 1m interval (really close SL and TP to each other).
If interval is set to 5m and higher trigger point can be calculated just based on high values if candle is Bullish or Low value if candle is Bearish
In case you would want to solve this also for 1m interval. I would do estimated guess what was first :
if candle is Bullish then first swing was Low then High and then Close
if candle is Bearish then first swing was high then Low and then Close
there is not other option to estimate it without tick in time data.
Correct me if i'm wrong or wrongly understood logic for calculation.... I did not found any other possible error in calculations logic.
from binance-futures-trading-bot.
Yeah your logic is sound I had a similar thought recently the highs and lows would be a better price value to consider.
Yeah I can't find any errors either, but if you run any of the strategys with the trailing stop it just explodes into the millions currently I'm fairly sure, heres a screenshot I just ran haha no way these results are correct so must be a rounding error.
It does hint at a bug though, opens a position on doge and doesnt close it but then opens a position on rose which shouldn't happen in the backtester... so maybe we can find the bug. Trailing stop is huge on doge and python is prone to rounding errors, if this is the issue in order to solve I may need to use a decimal library to represent the numbers.
from binance-futures-trading-bot.
Related Issues (20)
- Unable to use Heikin Ashi with new bot HOT 2
- Combining historical data with live data issue (Fix suggestion) HOT 3
- Is this line correct? HOT 2
- Live_Bot.py - ImportError: cannot import name 'ThreadedWebsocketManager' from 'binance' HOT 4
- Error Process HOT 1
- ZeroDivisionError: division by zero HOT 2
- multiple strategy HOT 1
- the bot was not tracking trade can you tell me what is the problem HOT 1
- Following Binance APIs are deprecated. HOT 1
- Error occurred during live_trading HOT 7
- Quantity less than or equal to zero. HOT 3
- Connection aborted issue on azure app service HOT 8
- Issue HOT 1
- the bot does not start HOT 2
- issue HOT 2
- Bot cannot run ubuntu os. Pls help!!! HOT 3
- There is no place to call the check_close_pos function in the latest version.
- Mexc
- Heikin_Ashi Strategy, TSL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binance-futures-trading-bot.