• Overview
  • Reviews
  • Comments

Extended TradeLevels

This library can be used as a replacement for the built-in trade levels. In addition to a beautiful presentation, there are some other features:

 

Fully Customizable

The colors and line styles can be set for both positions and orders.

Alignment for Positions and Orders

Positions and orders can be aligned at the left, center or the right of the chart area.

Order Action - Remove

Delete an entire order, stop loss or target stop.

Order Action - Edit

Drag the line of entry, stop or target to a new value, the order will be changed by this library.

Order Action - Collapse/Expand

Expand and collapse the visual representation of the trade levels.

Position Action - Remove

Delete the entire position, stop loss or target stop.

Position Action - Edit

Drag the line of entry, stop or target to a new value, the position will be changed by this library.

Position Action - Collapse/Expand

Expand and collapse the visual representation of the trade levels.

 

The Functions Exported by this Library:

  • ExtendedTradeLevels_SetNamespace sets a namespace prefix for the graphical objects, so they do not collide with other objects. The default namespace is set to "ExtendedTradeLevels".
    void ExtendedTradeLevels_SetNamespace(const string namespace);
    Parameters:
    namespace - the namespace prefix to use for graphical objects

    Returned Values:
    No.

    Note:
    This function must be called before ExtendededTradeLevels_Init(), if it is called after this function, the change has no effect.

  • ExtendedTradeLevels_Init initializes the Extended TradeLevels library. This function must be called in the EA's OnInit() function.
    int ExtendedTradeLevels_Init(void);
    Parameters:
    No.

    Returned Values:
    Corresponding to the OnInit() return values, INIT_SUCCESS is returned for success and INIT_FAILED for failure.

  • ExtendedTradeLevels_DeInit deinitializes the Extended TradeLevels library. This function must be called in the EA's DeInit() function.
    void ExtendedTradeLevels_DeInit(const int reason);
    Parameters:
    reason - the deinitialization reason, corresponding to EA's DeInit() function reason parameter.

    Returned Values:
    No.

    Note:
    As reason parameter provides the reason parameter from the EA's DeInit() function.

  • ExtendedTradeLevels_ChartEvent calls the chart event handling of the Extended TradeLevels Library. This function must be called in the EA's OnChartEvent() function.
    void ExtendedTradeLevels_ChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
    Parameters:
    id - see OnChartEvent() ID parameter
    lparam - see OnChartEvent() lparam parameter
    dparam - see OnChartEvent() dparam parameter
    sparam - see OnChartEvent() sparam parameter

    Returned Values:
    No.

    Note:
    Provide the EA's OnChartEvent() parameters as they are to this function.

  • ExtendedTradeLevels_TradeTransaction calls the trade transaction handling function of the Extended TradeLevels library. This function must be called in the EA's OnTradeTransaction() function.
    void ExtendedTradeLevels_TradeTransaction(const MqlTradeTransaction& trans, 
                                              const MqlTradeRequest& request, 
                                              const MqlTradeResult& result);
    Parameters:
    trans - see OnTradeTransaction() trans parameter
    request - see OnTradeTransaction() request parameter
    result - see OnTradeTransaction() result parameter

    Returned Values:
    No.

    Note:
    Provide the OnTradeTransaction() parameters as they are to this function.

  • ExtendedTradeLevels_SetColor sets a color property used for displaying orders and positions. See below for a list of possible settings.
    void ExtendedTradeLevels_SetColor(const string paramId, const color c);
    Parameters:
    paramId - the ID of the setting
    c - the color for the setting ID

    Returned Values:
    No.

    Note:
    Below you can find a list of possible color settings.

  • ExtendedTradeLevels_SetInteger sets an integer property used for displaying orders and positions. See below for a list of possible settings.
    void ExtendedTradeLevels_SetInteger(const string paramId, const int i);
    Parameters:
    paramId - the ID of the setting
    i - the integer value for the setting ID

    Returned Values:
    No.

    Note:
    Below you can find a list of possible integer settings.

Possible Color Settings for the Extended TradeLevels Library:

paramId Description Default value 
orderEntryColor The color used for displaying an order entry trade level (Buy and Sell).  clrPaleGreen
orderStopColor The color used for displaying an order stop trade level (Buy and Sell).  clrMistyRose
orderTargetColor The color used for displaying an order target trade level (Buy and Sell).  clrAliceBlue
orderFontColor The color of the font, used in all order trade levels.  clrBlack
positionEntryColor The color used for displaying a position entry trade level (Buy and Sell).  clrPaleGreen
positionStopColor The color used for displaying a position stop trade level (Buy and Sell).  clrMistyRose
positionTargetColor The color used for displaying a position target trade level (Buy and Sell).  clrAliceBlue
positionFontColor The color of the font used in all position trade levels.  clrBlack


Possible Integer Settings for the Extended TradeLevels Library:

paramId Description Default value
orderAlignment The alignment specifies where the panels of the order trade levels will be placed. Possible values are:

1 - left alignment
2 - right alignment
4 - center alignment
1
orderEntryLineStyle This setting specifies the style that should be used for drawing an order entry line. One of ENUM_LINE_STYLE. STYLE_SOLID
orderStopLineStyle This setting specifies the style that should be used for drawing an order stop line. One of ENUM_LINE_STYLE. STYLE_SOLID
orderTargetLineStyle This setting specifies the style that should be used for drawing an order target line. One of ENUM_LINE_STYLE. STYLE_SOLID
positionAlignment The alignment specifies where the panels of the position trade levels will be placed. Possible values are:

1 - left alignment
2 - right alignment
4 - center alignment
4
positionEntryLineStyle This setting specifies the style that should be used for drawing a position entry line. One of ENUM_LINE_STYLE. STYLE_SOLID
positionStopLineStyle This setting specifies the style that should be used for drawing a position stop line. One of ENUM_LINE_STYLE. STYLE_SOLID
positionTargetLineStyle This setting specifies the style that should be used for drawing a position target line. One of ENUM_LINE_STYLE. STYLE_SOLID

 

Import the Extended TradeLevels Library Functions

To use the library functions, they must be imported as follows:

#import "ExtendedTradeLevels.ex5"
   int ExtendedTradeLevels_Init(void);
   void ExtendedTradeLevels_SetNamespace(const string namespace);
   void ExtendedTradeLevels_DeInit(const int reason);
   void ExtendedTradeLevels_ChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
   void ExtendedTradeLevels_TradeTransaction(const MqlTradeTransaction& trans, 
      const MqlTradeRequest& request, const MqlTradeResult& result);
   void ExtendedTradeLevels_SetColor(const string paramId, const color c);
   void ExtendedTradeLevels_SetInteger(const string paramId, const int i);
#import


Sample Expert Advisor Using the Extended TradeLevels Library:

//+------------------------------------------------------------------+
//|                                                          ETL.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"

// Import of the Extended TradeLevels library functions
#import "ExtendedTradeLevels.ex5"
   int ExtendedTradeLevels_Init(void);
   void ExtendedTradeLevels_SetNamespace(const string namespace);
   void ExtendedTradeLevels_DeInit(const int reason);
   void ExtendedTradeLevels_ChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
   void ExtendedTradeLevels_TradeTransaction(const MqlTradeTransaction& trans, 
      const MqlTradeRequest& request, const MqlTradeResult& result);
   void ExtendedTradeLevels_SetColor(const string paramId, const color c);
   void ExtendedTradeLevels_SetInteger(const string paramId, const int i);
#import

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   // set a namespace for the graphical objects created in the Extended TradeLevels library
   ExtendedTradeLevels_SetNamespace("myEA");
   // Initialize the Extended TradeLevels library
   int result = ExtendedTradeLevels_Init();
   
   return(result);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   // Deinitialize the Extended TradeLevels library
   ExtendedTradeLevels_DeInit(reason);
  }
//+------------------------------------------------------------------+
//| Expert chart event function                                      |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
  {
   // Call the Extended TradeLevels library's chart event handler
   ExtendedTradeLevels_ChartEvent(id, lparam, dparam, sparam);
  }
//+------------------------------------------------------------------+
//| Expert trade transaction function                                |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
   // Call the Extended TradeLevels library's trade transaction handler
   ExtendedTradeLevels_TradeTransaction(trans, request, result);
  }
No reviews