saveStatus(string FileName)

loadStatus(string FileName)

Saves and loads the current trading status to a .trd file in the Data folder. The file contains the status of open real and phantom trades, the status of the sliders, and component specific variables (AlgoVar). This function can be used to resume trading at the last stored state in case of a server crash or reboot, or to let a fallback server take over the trading in case of a hardware failure.

Parameters:

FileName

Name and path of the file, or 0 for a default name like "Data\\scriptname.trd".


SaveMode

This variable determines by several flags what's saved or loaded in the .trd file in [Trade] mode or when calling the saveStatus/loadStatus functions.

Flags:

SV_SLIDERS  - save/load slider positions (default).
SV_ALGOVARS  - save/load all AlgoVars (default).
SV_ALGOVARS2 - save/load all AlgoVars2.
SV_TRADES  - save/load all open trades (default).
SV_STATS  - save/load statistics data, to be continued in the next session.
SV_BACKUP
  - after loading, save a backup of the .trd file (default).
SV_HTML  - after loading trades in [Test] mode, generate a HTML file with the list of open trades.

Type:

int

Remarks:

Example:

function run()
{
  if(Bar >= 1) { // default asset is selected after first run
    AlgoVar[0] = 123;
    SaveMode = SV_ALGOVARS+SV_ALGOVARS2; 
    saveStatus("Data\\Test.trd");
    AlgoVar[0] = 456;
    printf("\n %.0f",AlgoVar[0]);
    loadStatus("Data\\Test.trd");
    printf("\n %.0f",AlgoVar[0]);
    quit("ok!");
  }
}

See also:

AlgoVar, assetHistory, Trading

► latest version online