Menus

This lesson will explore some possibilities for the menu numbers that appear when a Script Editor form is open.

The menu digits can be a convenient way to access frequently used studies, draw tools, color bars, or times buttons that are available on drop down panels when a chart is displayed.  For our purposes, lets assign the menu digits to accomplish the same tasks that otherwise would have to be selected from a drop down panel.  Each of the menu digits will assign the Who value with its number and execute the ESPL engine.

    Let's assign menu
  • 5 to select a 5-minute chart.
  • 6 to select the Trends color bar study.
  • 7 to select the Stochastics study.
  • 8 to select the RSI study.
  • 9 to delete all studies and draw tools from a chart.

begin
  if who=5 then begin
    btnTime5.tag:=5;
    btnTime5.hint:='5-minute';
    btnTime5.caption:='5';
    btnTime5.click;
  end;
  if who=6 then begin
    mnu6.caption:='Trend';
    lstColorBar.ItemIndex:=11;
    lstColorBar.Click;
  end;
  if who=7 then begin
    mnu7.caption:='STO';
    lstStudy.ItemIndex:=0;
    lstStudy.Click;
  end;
  if who=8 then begin
    mnu8.caption:='RSI';
    lstStudy.ItemIndex:=1;
    lstStudy.Click;
  end;
  if who=9 then begin
    mnu9.caption:='Remove';
    btnObjects.click;
    btnRemoveAll.click;
  end;
end;

Notes:  Copy and paste the sample script to the Script Editor.  Display a chart and then click on the menu digits 5 though 9 and watch the effect.  We relabel the menu so future use will be easier to remember the purpose of the menu item.