Displaying some information

I now add some information about the status of the EA, and the parameters passed to the callbacks.

The call to OnDeinit passes an integer value called ‘reason’. I wrote a simple class with a static function which will translate the integer into a string.

struct UninitReason
{
    static string ToString(int id)
    {
        switch (id)
        {
            case REASON_ACCOUNT:     return "account was changed";
            case REASON_CHARTCHANGE: return "symbol or timeframe was changed";
            case REASON_CHARTCLOSE:  return "chart was closed";
            case REASON_PARAMETERS:  return "input-parameter was changed";
            case REASON_RECOMPILE:   return "program was recompiled";
            case REASON_REMOVE:      return "program was removed from chart";
            case REASON_TEMPLATE:    return "new template was applied to chart";
        }
        return "unknown " + IntegerToString(id);
    }
};

I then called the static function ToString from my OnDeinit callback function:

void OnDeinit(const int reason)
{
    Print(__FUNCTION__ + "; reason=" + UninitReason::ToString(reason));
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s