?> QuantXpress – Deliver high performance automated trading and connectivity solutions



Common Strategy Event Functions

BlitzTrader trading system development API (BTS API) exposes following event-driven methods that your strategy implementation class must implement. Event notification condition describes the circumstances under which each of the following event call-backs are invoked.


Callback Conditions
OnInitialize Invoked when strategy instance is loaded. Once your code is initialized the requested data is pushed into your strategy through events. The event triggered depends on the data you request or subscribed.
OnStart Invoked in response of user started the strategy. Here one would normally reset the variables and does other strategy setup operations.
OnMarketDataEvent OnMarketDataEvent is called on every change in market data of subscribed instruments from strategy. The method receives a StrategyMarketDataEventArgs of a particular instrument and can be used to retrieve latest market prices like Bid, Ask, LTP. Here one would implement strategy logic which is related to price change.
OnStopping OnStopping is called before a strategy is stopped. Here, depending on strategy logic, one would consider closing all active orders, disposing any custom objects, etc.
ValidateStrategyParameter This function is called when user set to create the strategy instance by assigning a actual instrument to Instrument Variable (IV) or change of the input parameter value during the strategy control from trader console window. Based on strategy requirements, here developers can write a code to validate the parameter value before applying it to the internal variables. In case of validation failed. Developer can return a valid reason of failure.