This is something I've been trying to get to work for some time within one of my automated strategies. It works ok the way I've done it, but I've noticed a bug as of late when running live.
My goal is to take two times, and return the highest value into a variable using the MIN() or MAX() function.
What I have done previously, is find the highest value, and say when time equals that value, look back x number of bars to return the highest value. So if time equals 14:00, and I want to return the highest and lowest values say in between 13:30-14:00 on a 5 minute chart I have done the following:
if (ToTime(Time[0])== ToTime(14, 00, 0)) //gets the HH and LL between 13:30 and 14:00 { HH1 = MAX(High,6)[0]; LL1 = MIN(Low,6)[0]; }
Now this works, but it is also limited. In that it's confusing when I want to adjust for various times cause I have to count bars, and it also does not work if I backtest with a different time frame because I would have to factor in the new time with the proper amount of bars.
I think this can be done by using, "IDataSeries?"
If not, is there a simple way to accomplish what I want to do w/o doing it the goofy/cumbersome way I have done it?
Thanks,
Forrest
Comment