NinjaScript > Educational Resources > Developing Custom Fill and Optimizer Types >

Fill Types

Print this Topic Previous pageReturn to chapter overviewNext page

Custom Fill Algorithms

In addition to the two system fill types (Default and Liberal) you can also script custom fill algorithms using any code/text editor.


Copy the file "Documents\<NinjaTrader Folder>\bin\Custom\Type\@LiberalFillType.cs" and provide a new name excluding the "@" sign such as "Documents\<NinjaTrader Folder>\bin\Custom\Type\MyFillType.cs".


Then within your code editor:


1.Provide a new display name for example rename "Liberal" to "MyFill"
2.Provide a new class name for example rename "LiberalFillType" to "MyFillType"
3.Code your fill algorithm within the Fill() method
4.Once complete, open any indicator or strategy within the NinjaTrader NinjaScript Editor and compile. This will compile the new fill algorithm and make it available within any backtest dialog window.