Integrated Lua EditorDebugger

From FxCodeBaseWiki
Jump to: navigation, search

Integrated Editor, Indicator Debugger, and Strategy Debugger

You can use integrated Editor, Indicator Debugger, and Strategy Debugger to:

  • Edit the code of an indicator or strategy
  • Execute an indicator or strategy step-by-step (see Indicator Debugging and Strategy Debugging )
  • Check indicator or strategy performance
  • Backtest a strategy on the historical data over a long period of time
  • Compile an indicator or strategy

Using Indicore 3 Editor/Debagger as an Editor

Editing the code of an indicator or strategy

The Editor is intended mainly for creating and modifying the source code of indicators and strategies.

  • The editor highlights all Lua and JaveScript key constructions such as comments, key words, constants.
  • You can cut, copy, or paste the code by using the clipboard and standard clipboard shortcuts (Ctrl-X, Ctrl-C, Ctrl-V)
  • You can undo the last operation.
  • You can search inside the code by using the regular text or Perl-Compatible Regular Expressions (PCRE documentation).

This is just a replacement for Notepad rather than a professional programmer editor. Most of the programmers have their own preferred programmer editors, but we've got no reason to compete with all these MultiEdit or UltraEdit.

Wizards

You can also create a template for an indicator or strategy by using the File->Indicator ->New or File->Strategy ->New commands. The dialog box to edit the basic indicator or strategy parameters appears. You can specify the basic things such as parameters, output streams, and so on, and the wizard will create all basic functions for you. Of course, all complex logic still has to be programmed in the Lua language or JavaScript language.

File Locations

In the default configuration:

  • User indicators are located in the indicators subfolder of the IndicoreSDK folder.
  • Standard indicators are located in the indicators\standard folder of the IndicoreSDK folder.
  • User strategies are located in the strategies subfolder of the IndicoreSDK folder.
  • Standard strategies are located in the strategies\standard folder of the IndicoreSDK folder.

The default folder locations can be changed.

Using Indicore 3 Editor/Debagger as a Debugger

For regular debugging, see Lua Debugging.
For indicator specific issues, see Debugging Indicator.
For strategy specific issues, see Debugging Strategy.

Check Indicator or Strategy Performance

Performance is an ability of an indicator or strategy to process a lot of data fast. You cannot estimate the real performance of an indicator or strategy while debuging it, because running an indicator or strategy in the debugging mode has a big overhead of additional operations and is much slower than a real execution of the same indicator or strategy in Marketscope 2.0. Indicator or strategy performance can be checked with the help of the Check Performance and Backtest commands (Project->Check Performance or Backtest). Indicator configuring is same as Indicator Debugging. Strategy configuring is same as Strategy Debugging. The debugger executes an indicator or strategy as fast as Marketscope 2.0 does and prints statistics on its Output page. Recommended performance data:

  • For bar indicators ̶ not less than 100,000 bars per second. Slower indicators may significantly slow down the backtesting process.
  • For bar strategies ̶ not less than 20,000 bars per second. It takes just 15 seconds to test a strategy over one year even if the strategy uses one-minute data.
  • For tick strategies ̶ not less than 50,000 ticks per second. It takes just 60 seconds (one minute) to test a strategy over one year even if the market is simulated with the help of one-minute data.

See also:

Backtest a strategy

Backtesting is collecting trading statistics when a strategy is executed over a chosen period of time (for example, one year). As for the performance testing, the debugging mode is too slow for backtesting, thus, to check strategy performance during a long period of time, you need to run it in Marketscope-like mode to avoid the overhead operations of debugging. During backtesting, you cannot see a step-by-step execution of the process. When it is finished, you are presented with the final results in the form of statistics and a chart. Backtesting is always performed by default when you check the performance of a strategy. For details, see Backtesting Strategy.

Compiling an Indicator or Strategy

If an indicator or strategy is distributed as a compiled file, other users cannot see and change its code. Compiling does not affect indicator or strategy performance because exactly the same LuaJIT (just-in-time) compiler is used for executing the Lua/JavaScript code. Compiling of the code into a virtual machine is much faster than data loading, so there is no effect even during indicator or strategy loading. Thus, the only reason to compile an indicator or strategy is to hide the source code to protect your business idea or to prevent the code's being changed by the others.

This Article in Other Languages

Language: English  • español