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



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