Try this, i thought it is exect according to your requirement i code this EA, i would like feedback from you.
Custom Input TimeFrame open line — I modify this Indicator may useful for someone
Try this indicator