Skip to content
FXNook HubBeta

Alex / Auto Stop Loss and Take Profit EA for MT4

MetaTrader 4Expert AdvisorMITCompiled · build 2425
Compile logCompiled
MetaEditor build 2425 · MT4 · 1 Dec 2026, 10:18 UTCcompiling FXN_AutoSLTP.mq4✓ Result: 0 errors, 0 warnings, 3.7 soutput FXN_AutoSLTP.ex4 · 17 KBsha256 ac4193e69302897a…34dd728a

Files version 1.0

FileLinesSize
FXN_AutoSLTP.mq42138 KB
FXN_AutoSLTP.ex4 compiled by the Lab–17 KB
FXN_AutoSLTP.mq4213 lines
//+------------------------------------------------------------------+//| FXN_AutoSLTP.mq4                                                 |//| 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."#property strict//--- 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  };sinput string         InpGroup1      = "=== Which trades ===";  // ===== Which trades =====input ENUM_FXN_SCOPE  InpScope       = SCOPE_ALL;               // Trades that get a stop loss and take profitinput int             InpMagic       = 0;                       // Magic number (used with "Only trades with the magic number")sinput string         InpGroup2      = "=== Distances ===";     // ===== 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)sinput string         InpGroup3      = "=== Timing ===";        // ===== Timing =====
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