Skip to content
FXNook HubBeta

Alex / Auto Stop Loss and Take Profit EA for MT5

MetaTrader 5Expert AdvisorMITCompiled · build 6333
Compile logCompiled
MetaEditor build 6333 · MT5 · 1 Dec 2026, 10:19 UTCcompiling FXN_AutoSLTP.mq5✓ Result: 0 errors, 0 warnings, 4.1 soutput FXN_AutoSLTP.ex5 · 33 KBsha256 17584aafcd818d4c…fc78ff05

Files version 1.0

FileLinesSize
FXN_AutoSLTP.mq52188 KB
FXN_AutoSLTP.ex5 compiled by the Lab–33 KB
FXN_AutoSLTP.mq5218 lines
//+------------------------------------------------------------------+//| FXN_AutoSLTP.mq5                                                 |//| FXNook Lab Hub starter library - MIT licence                     |//| https://lab.fxnook.com/hub                                       |//+------------------------------------------------------------------+#property copyright "FXNook Lab (MIT licence)"#property link      "https://lab.fxnook.com/hub"#property version   "1.00"#property description "Adds a stop loss and take profit (in points or ATR) to any chosen trade that opens without one, within a second."#include <Trade\Trade.mqh>//--- which trades get stopsenum ENUM_FXN_SCOPE  {   SCOPE_ALL    = 0, // All trades on this symbol   SCOPE_MAGIC  = 1, // Only trades with the magic number below   SCOPE_MANUAL = 2  // Only manual trades (magic 0)  };//--- how the distances are measuredenum ENUM_FXN_DIST  {   DIST_POINTS = 0, // Fixed points   DIST_ATR    = 1  // ATR multiple  };input group "Which trades"input ENUM_FXN_SCOPE  InpScope       = SCOPE_ALL;      // Trades that get a stop loss and take profitinput long            InpMagic       = 0;              // Magic number (used with "Only trades with the magic number")input group "Distances"input ENUM_FXN_DIST   InpMode        = DIST_POINTS;    // Measure distances in points or ATRinput int             InpSlPoints    = 300;            // Points: stop loss distance (0 = do not add a stop loss)input int             InpTpPoints    = 600;            // Points: take profit distance (0 = do not add a take profit)input ENUM_TIMEFRAMES InpAtrTimeframe= PERIOD_CURRENT; // ATR: timeframeinput int             InpAtrPeriod   = 14;             // ATR: periodinput double          InpAtrSlMult   = 1.5;            // ATR: stop loss = ATR x this (0 = do not add)input double          InpAtrTpMult   = 3.0;            // ATR: take profit = ATR x this (0 = do not add)
Sign in to read all the code and download it

It is free. A free account lets you see every line, copy it, download the source and open a copy in your Lab. The compiled file can be downloaded without an account.

Sign in Create a free account

Version history

  1. Version 1.0Live1 Dec 2026

    First version.

    Source · Compiled