15
C# Trading System Example
This is an example that shows how to convert the pre-install sample C# project SimpleMovingAverage2VCS and modify it into a C# trading system.
First copy the whole project directory along with IDL header file (SimpleMovingAverage2VCS.IDL) from NeoTicker installation directory Samples/VC# Examples/MakeIndicator Example sub-directory, to a seperate location on the local harddisk for modifying.
Before opening the project file rename the probject file to MovingAverageCrossSys. Open project file and change all properties project into the new name MovingAverageCorssSys as well.
After changing all project properties proceed to change the main code body MainIDL.
The system I used for this example is a simple moving average crossover system, it requires three indicators: fast moving average, slow moving average and crossover.
Original frame work from C# makeindicator example already has one makeindicator call, so all I have to do is copy those lines and change indicator call components to create additional indicators for crossover signals.
I want to make sure the signals work as expected before adding trade objects to trigger buy/sell. So I added a plot to plot the crossover signals and build it as an intermediate version to make sure the signals work.
In order to run the intermediate verion indicator in NeoTicker, copy files: MovingAverageCrossSys.dll (Note: Interop.NeoTicker.dll is also required if it is not present under NeoTicker indicator directory) from C# project sub-directory bin\Release to NeoTicker installation directory indictor sub-directory.
Copy MovingAverageCrossSys.idl header file into NeoTicker indicator sub-directory along with DLL file, use script editor to open this IDL header file to install the indicator.
The intermediate indicator plot on chart moving average cross signals as dots, where fast cross above slow are plotted as 1 and fast cross below slow are plotted as -1.
Add two moving average lines on the chart to visually confirm cross signals are working as expected, next add trade execution part of the system.
Add required code to enter trades, build modified project at C# application and copy the resluting DLL file over to NeoTicker indicator directory. Open IDL header file at NeoTicker script editor and disable the indicator first, before replacing DLL file at indicator directory.
A second plot is need to plot system equity curve so at script editor> indicator setup add another plot to show it, install IDL header and system can be run with trades.
Download