HiLo Activator

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;

Capture

Hi Matthew

Are you able to advise what this script will look like if it was for a daily time frame and the MA being for 3 periods.

Apologies as I do not do too much scripting but am trying to develop my Gann Swing strategy.

Regards

Hi Ibrahim,

The script formula above was used in a Show Plot tool. Change the dh1 and dl1 variables in the above to use the timeframe of the chart by removing the weekly w1 variable, and set the calculation to 3 bars:

dh1 = MA(CALC=High, BARS=3);
dl1 = MA(CALC=Low, BARS=3);

If you are interested in learning more about the power of the Optuma scripting language see the video tutorial courses under the Help > Scripting Resources menu in the software.