-
Notifications
You must be signed in to change notification settings - Fork 3.9k
EMA Calculation incorrect using Warm-up data #1206
Comments
I realize there is another bug report similar to this issue that I am having. I think the bug report is different, but possibly the root underlying cause is the same? I am not sure. I didn't quite understand the issue that was submitted, so I posted my own. This might be a duplicate issue. |
What do you mean with inaccurate? Could you provide logs or numbers (including the dataset & EMA parameters to reproduce)? |
Let me go through the issue in chronological order to show the issue. Please let me know if there is any confusion. Setup: Scenerio: Picture #2: This is a picture of the data that was exported from SQLITE and into Tradestation (3rd party software). Please note the time stamp of 11:10. There are TWO EMA outputs on the screen for 11:10 which are 5327.62 and 5207.99. These values are calculated in Tradestation (not Gekko). The only thing I pulled from Gekko was the data. Observation. If you compare Picture #1 and Picture #2 you will see that the 11:10 time stamp show identical values (there is a small rounding error for the 125 min candle, but that is not a big deal). At this point, everything looks good and the quality control check shows that the data calculations are accurate. Picture #3: Picture #4: Picture #5: In this real time example, the error in calculation of the 125 candle EMA is 5322.14 vs 5320.06. This is actually smaller then I have seen before and I believe it has to do with the fact that I stopped gekko and started it within a few seconds (see picture #3). This is not the case in real life when I may stop it for 5 or 10 minutes while I make updates.....the difference in the EMA value can be 10-20 points sometimes. Hopefully this helps in some way. Let me know if you need me to test anything or provide extra info. Thanks again for all the hard work with this. It's a great program. |
Anyone have any thoughts on why this may be happening? I think the issue could potential be effecting the true values of all the TA indicators that are being used. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me. |
Note: for support questions, please join our Discord server
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
Action taken (what you did)
I run gekko using command line so that it can stitch together historical data so that I can use EMA's for my strategy
Expected result (what you hoped would happen)
I log the EMA value to the console so that I can track the result of the EMA on each candle.
I currently export the SQLITE database into a CSV and run the same strategy on the Tradestation platform as a quality control check. I check to see that the console value matches the one in Tradestation.
Actual result (unexpected outcome)
The value of the EMA's when gekko starts are incorrect. I am not sure why, but they do not match with what Tradestation shows (the database is the same and the EMA calcs are the same). I currently run 2 EMA's (a short and a long).
Both the long and the short EMA eventually become correct and in sync with what they should be, but this is dependent on getting data while in live mode. For example, a 10 candle EMA will be accurate once gekko has been running live for 10 candles..... but it should be correct from the moment gekko starts using the command line, no? It should be able to pull historical data and give an accurate value.
Given that the values do eventually become accurate, I believe the bug has to do with calculating values with data that is both historical (in the database) and new data that comes in while gekko is running live.
The text was updated successfully, but these errors were encountered: