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 Initialize state.
protected override void OnStateChange() { if (this.State == State.Initialize) { AddInstrument("RELIANCE NSE"); //add a seconday script //do other stuff } }
OnLevel1(Int32, RealTimeDataEventArgs)
The OnLevel1 method is called upon each incoming RealTimeDataEventArgs data when a Level1 stream is opened. The same can be opened by setting the IsLevel1Subscribed property to true when the Scanner's State is in Initialize state.
protected override void OnLevel1(int idx, RealTimeDataEventArgs e) { //your code here }
The OnPosition method is called when the position gets updated.
protected override void OnPosition(PositionEventArgs e) { //your code here }