Trading SystemSome of you may be wondering how to use the ESPL language to create a simple Trading System. The following ESPL program opens an IBM daily chart and runs a Trading System based on the crossing of two Simple Moving Average lines. The system will buy when the average lines cross up. The system will sell when the average lines cross down. The ResetTrades command is used to initialize the trading system with no commissions and specific trade arrows. A FOR loop and the GetStudy command are used to loop through the bars and determine when the lines cross. The Trade command is used to create each trade. A TradeReport is printed in the Output window when the system is finished. Arrows will mark each trade on the chart. Read the on-line ESPL help documentation for details on each command.Copy and Paste the following code to your Script Editor window to try it out. Click the ESPL button in Ensign Windows to open the Script Editor window. Paste the code into the left window. Click the RUN button in the Script Editor window to run the Trading System on the IBM chart. Change the symbol to something else to test a different market. Substitute a different study (like Stochastics) to test the crossing of different kinds of lines. The code below includes a comment (at the end of the line) to document each line. Select Chart | Trade Detail from the Ensign Windows menu to view the individual trades generated by the system, or click the Results button in the Script Editor window. var
{Start of Variable declarations} |