run()

Main strategy function, written by the user. It is automatically started after clicking on the [Train], [Test], and [Trade] buttons. After that, it is run once for every bar of the simulation. This is continued until the end of the simulation data or until [Stop] is hit. The run function initializes sliders and sets up all needed indicators.

Remarks:

Example:

function run()
{
  vars SmoothPrice = series(LowPass(series(price()),100));

  if(valley(SmoothPrice)) enterLong();
  if(peak(SmoothPrice)) exitLong();
}

See also:

Workshop 4, Bars and Candles, Bar, BarPeriod, tick, tock, user supplied functions

► latest version online