Click or drag to resize

How to develop a DomScript

User can code custom scripts in order to render the content that will be displayed in the Dom View. The DomScriptBase class exposes the Plot method which can be used to render the view as per his requirement.

Abstract methods

OnRender(DrawingContext, ChartVisualArgs)

The OnRender method is called by ArthaChitra when it renders the Dom View. User must override this property to define how the data will be displayed.

Read historical data

One can read the historical data from the Dom Script itself by calling the GetHistoricalData(BuiltDataType, BackfillPolicy, DateTime, DateTime) method. Please make sure to call the methon from the OnStateChange method when the state is StartUp state

The returning data, if available will be invoked from the OnHistoricalData(BuiltDataType, DateTime, Double, Double, Double, Double, Double, Double, Double, Double) method.

C#
protected override void OnStateChange()
{
    switch (this.State)
    {
        case State.Initialize:
            break;
        case State.Configure:
            break;
        case State.StartUp:
            GetHistoricalData(BuiltDataType.Tick, BackfillPolicy.Default, DateTime.UtcNow.Add(Globals.TimeZoneOffset).Date, DateTime.UtcNow.Add(Globals.TimeZoneOffset));
            break;
        case State.Finalize:
            break;
        default:
            break;
    }
}

//incoming data will be invoked here
protected override void OnHistoricalData(BuiltDataType builtDataType, DateTime time, double open, double high, double low, double close, double bid, double ask, double volume, double oi)
{
    //do stuff
}
Understanding State

During the life cycle of a DomScript it goes through different stages or processes. In each stage the DomScript performs a set of jobs. In which state the indicator s in is defined by the State property. Whenever the state gets changed it raises the method OnStateChange. The different states which a DomScript goes through are:

  • Initialize - User can initialize classes, define variables etc. here.
  • StartUp - The DomScript is on the roll.
  • Finalize - Called when the DomScripts encounters an exception or is being finalized (disposed off). All clear up codes should be placed here.
Configuring properties via GUI using Xaml templates