Interactive Trade Levels EA (Utility) for MT5

Interactive Trade Levels EA (Utility) for MT5

2 October 2026, 22:57
Ryan L Johnson
0
37

Here is an MT5 utility in the form of an EA that shows levels of positions, SL, TP, and pending orders similarly to TradingView's trade levels. Note that they are similar─not exactly the same. The EA has quite few inputs, so I'm listing them all right here:

//--- price levels (0 = derive from market on attach / hidden)
input double InpLongEntry   = 0.0;      // Long entry price (0 = Ask on attach)
input double InpShortEntry  = 0.0;      // Short entry price (0 = Bid on attach)
input double InpStopLoss    = 0.0;      // Stop loss price (0 = hidden)
input double InpTakeProfit  = 0.0;      // Take profit price (0 = hidden)

//--- order sizing and execution
input double InpRiskPercent = 1.0;      // Risk, % of balance (auto lot size)
input double InpFixedLots   = 0.0;      // Fixed lots (0 = auto from risk)
input long   InpMagic       = 20261001; // Magic number of orders placed
input int    InpDeviation   = 30;       // Max price deviation, points

//--- live linking and interaction
input bool   InpShowPlaceholders = true; // Show placeholder levels when long/short entry = 0
input int    InpPlaceGap        = 35;         // Placeholder level gap from market, points
input bool   InpTrackPositions = true;  // Auto-link levels to open positions
input bool   InpLinkAllPositions = true; // Also link manual (magic 0) positions
input bool   InpTagMenu        = true;  // Click price tags for a quick-action menu
input int    InpDragApplyMs    = 350;   // Apply drag changes after idle ms
input bool   InpDragEnabled    = true;  // Allow dragging levels
input int    InpDlgStepPoints  = 100;     // Modify dialog +/- step, points

//--- appearance
input color  InpLongColor   = clrDodgerBlue; // Long color
input color  InpShortColor  = clrOrange;     // Short color
input color  InpSLColor     = clrRed;        // Stop loss color
input color  InpTPColor     = clrLime;       // Take profit color
input color  InpPanelColor  = clrNavy;       // Levels panel background
input color  InpTextColor   = clrWhite;      // Text color
input string InpFont        = "Arial";       // Font
input int    InpFontSize    = 5;             // Font size
input int    InpTagsBars    = 4;             // Price tag distance from right edge, bars

You can use the price levels inputs (4) to set the prices of your initial order(s), or you can use InpShowPlaceholders to initially draw "dummy" price levels. If you use the latter method, the first level (Long or Short) that you drag and drop will automatically remove the opposing dummy level─and a confirmation dialogue will appear, allowing you to add a SL and TP.

SL and TP prices are set using +/- buttons in the dialogue. InpDlgStepPoints controls the size of the increments in which clicking +/- will increase/decrease the price setting, and click-and-hold on the +/- buttons is supported.

Dragging levels will also cause the dialogue to appear for confirmation, and clicking the X on the right side of a level label will close that level's respective position, SL, TP, or pending order.

That is basically all that you need to start using the utility. Just be aware that I compiled the current version of the utility while the market was closed which made live market testing impossible for a few features/functions added in the final hour. Therefore, test in demo first and please post up any issues, problems, or bugs that you might discover.

Files: