0
1
I'm writing a bot that acts on market signals - currently just based on exponential moving averages. At the moment, I have the program watching the market on multiple different period lengths. For example, it will grab the last price right now, calculate and log a moving average if there is enough data, and then 60 minutes from now do the same. It can be doing this for 5min, 15min, 30min, 2h, 4h, etc. etc. time periods.
However, If I have an algorithm making decisions every 60 minutes, It could very easily lose a lot of money in between the two calculations. My thought is that I should be grabbing market data and calculating values every 1 or 2 minutes, and base those calculations on data from period_length time ago. It still obviously charts a 60 min or 2h or w/e chart, but does so every 1 min in order to react as fast as possibly to changes.
Is this the correct approach, or am I way off on this?
Thanks, that's informative. How I wrote it to work, is it fetches a new price every 60 seconds. If it is trying to calculate a 5 minute period EMA, it will create a calculation with a "period index", starting from 0 and counting up until it reaches 4. The EMA calculator will always use the data from the same period index, but it can be calculated every 60 seconds once there is enough historical data. – Andy Bas – 2014-01-01T23:01:11.247