How to develop a Market Scanner |
The ScannerBase ScriptType lets the user to add custom columns in the Market Scanner View.
The Market Scanner View's cells are bounded to the DisplayValue property. Any computed value has to be assigned to the DisplayValue property in order to be displayed in the column cells.
The OnStateChanged method is called whenever the State of the script is changed. The various states which a Scanner class have are:
protected override void OnStateChange() { //your code here }
The Market Scanner user code supports seconday instruments and it can be added by simply calling the AddInstrument method when the Scanner's State is in StartUp state.
protected override void OnStateChange() { if (this.State == State.StartUp) { AddInstrument("RELIANCE NSE"); //add a seconday script //do other stuff } }
OnLevel1(Int32, Level1EventArgs)
The OnLevel1 method is called upon each incoming Level1EventArgs data when a Level1 stream is opened.
protected override void OnLevel1(int idx, Level1EventArgs e) { //your code here }
The OnPosition method is called when the position gets updated.
protected override void OnPosition(PositionEventArgs e) { //your code here }
OnRender(DrawingContext, ScannerVisualArgs)
The Market Scanner/Option Chain data grid cell, by default displays the string value of the property DisplayValue. However if user wants to display anything other than text, he can do it by overriding the OnRender method.
protected override void OnRender(DrawingContext dc, ScannerVisualArgs args) { //your code here }