| Jim Dean Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA User Profile | I'm not exactly sure what you mean by the list of days, but it's likely to require much more complex coding to be able to input #days ... presumably for an intraday current timeframe. So, the code below leaves that up to you ... you decide how many bars must be in the average to cover the calendar time span that you want. This code extracts the bars for APPROX the time windows you specified for the unweighted sum of those three symbols ... the precise windows can be coded but too time consuming for me right now, especially at N/C ;~) #Indicator #param "AvgPds", 20, 10, 40 #param "DayNiteBoth", 1, 1, 3 dim Globex, AvGX, Live as single if bardayofmonth()<>bardayofmonth()[1] then Globex = 0 if DayNiteBoth = 1 or DayNiteBoth = 3 and barhour()>=9 and barhour()<=16 then Live=true if DayNiteBoth = 2 or DayNiteBoth = 3 and barhour()>=18 or barhour()<=9 then Live=true if Live then Globex = GetVolume("ESH16")+GetVolume("YMH16")+GetVolume("NQH16") if bar >= AvgPds then AvGX = SMA(Globex,AvgPds) plot("AvGX",AvGX) end if return AvGX ... have not tested the code but barring some dumb syntax typo it should work fine. | |