Here is a script that I had to write for the CMT3 course that I am doing. It is based on Robert Krauz’s work and it take the average of the highs and the average of the lows. Only one of the lines is ever shown depending on which line last got broken. To achieve this in scripting, I used the SWITCH function to set the status and then the IF statement to choose the values I wanted. The last part just formats the output as dots like a PSAR tool.
w1 = WEEK(); dh1 = MA(w1, CALC=High); dl1 = MA(w1, CALC=Low); UseLow = switch(high() > dh1, low() < dl1); WeekHiLo= if(UseLow, dl1, dh1); // Format the Plot Plot1 = WeekHiLo; Plot1.Caption = Weekly HiLo Activator; Plot1.Colour = Blue; Plot1.Plotstyle = Dot; Plot1.LineWidth = 3;