EA acting haywire after computers hibernates for a while
There is nothing to reset. You test if the trigger condition is currently true. The red dot is 40 bars away. If you are using shift=1 then the red dot is irrelevant. Your code is BROKEN.
Could you give me some general and basic idea on how to do that?
easy idea:
you could make the EA check when was the last tick, and to disable trading if it was more than X minutes ago (that is abnormal)
and maybe send you a warning via email or "push notification"
- You could test the times of those bars and make sure they are consecutive (Won't trade the first bar of the new week)
- I think it isn't necessary. When it reconnects, it redownloads all bars that are missing, so test #1 will do nothing.
- I still think your code is BROKEN.
My EA is a simple one based on moving average (just checking for crosses between slow and fast EMA) and it was supposed to put the buy order at the red dot. What happened was that my computer had been hibernating way before the red dot, so when I turned it back on the EA was feeding on information from the point right before the computer hibernated. Thus the EA instead put a buy order at the purple dot which does not make sense at all. So is there a general way to fix this problem especially when the computer hibernates (or internet connection is lost) while metatrader and EA are still running? Btw my slow EMA is yellow and fast EMA is white
Thanks