Preserve Existing Bars

In the eSignal version, on the Setup | Manager form is a checkbox called Preserve Existing Bars.  This choice allows you to refresh a chart with bars from DBC.  If Preserve Existing Bars is unchecked, local bars will be replaced with bars from the DBC server.  If Preserve Existing Bars is checked, only bars that are missing from the chart will be added.

ESPL has a global Boolean variable called Preserve.  This variable reads or sets the status of the Preserve Existing Bars check box.  True for checked, and False for unchecked.  For non-eSignal version, Preserve is still an exposed global Boolean variable that can be used in your ESPL scripts.  It's state will be remembered between executions of the Ensign Windows program in the Ensign.ini file.

Example script:

var
  b: boolean;
  chartsymbol: string;
begin
  {code to set chartsymbol goes here}
  b:=Preserve;                      {read Preserve Existing Bars status}

  Preserve:=False;                  {turn off the Preserve Existing Bars mode}
  ChartReplace(chartsymbol);        {refresh chart with DBC bars having priority}
  if Finished(60) then Preserve:=b; {when finished, restore original setting}
end;