I am writing a multi-timeframe strategy. I basically have the strategy running on a minute interval. In the strategy I have added the 5,15,30,60,120,240,480 minute and 1 day timeframes.
When I run the script it loads all data based on the 1 minute interval. So far so good. But I would only like to see the data of the most current 1 minute bar.
Right now I loads 200 days of 1 minute data which is fine because I need to calculate indicator values for the different timeframes up to the daily (200 sma daily).
I would like to write the values into a textfile which also works fine but now it write every single minute data row into the textfile.
I am only interested in the value of the last 1 minute bar for all 9 timeframes.
So I would like to know what the 1,5,15,30,60,120,240,480 minute and daily 20/50/200 simple moving averages are for the most current 1 minute bar.
I figured I would just use something like
if DateTime.Now.ToString() == Time[0].ToSTring()

Anybody got any ideas?
Again, I don't want to know the historical simple moving average values. Just for the current state. But I need to load all days because I use multitimeframes in one script.
Love to hear suggestions.
Thanks!

Comment