Details
Expert Advisor TrailingStop-Toolkit Conception
It can be used for trade by expert advisers and for manual trading as well.
e-BJF-TrailingStop-Toolkit expert advisor contains 6 different TrailingStops (Standard, High/Low, ATR, Fractals, PSAR, ProfitPcnt), work days settings and work time settings.
a) Standard Trailing: simple trailing, stoploss follows by the market
b) High/Low Trailing: trailing by bars High/Low
c) ATR Trailing: trailing by ATR indicator
d) Fractals Trailing: trailing by Upper/Lower Fractals
e) PSAR Trailing: trailing by Parabolic Stop And Reverse indicator
Buy orders trailed if PSAR below the bars and moving up
Sell orders trailed if PSAR above the bars and moving down
f) ProfitPcnt Trailing: trailing with lock of some pcnt of max. profit reached
If Buy opened at 1.3000, ProfitPcnt = 40.0 and the market reaches 1.3100 then the trailing moves StopLoss to 1.3040, on 1.3200 StopLoss will be moved to 1.3080.
Every trailing has on/off option. You can activate any of them or all of them simultaneous.
You can use the expert on 4-digit and 5-digit accounts.
g) TrendLine Trailing
TrendLines make very effective day trading tools. A trendline's upward slope created by a stock creating higher highs, allows a day trader to trail a stop order directly under the trendline , allowing price to often run to new highs before the position is exited.
h) MovingAverage Trailing - stop loss will follow a moving averages.
How to test the expert advisor e-BJF-TrailingStop-Toolkit by StrategyTester and understand the behaviour of every trailing?
You can test e-BJF-Trailing Stop-Toolkit in MT4 Strategy Tester in visual mode with manual orders openning.
You can swith on tracking feature. Tracking (Visualisation) leaves traces of stoploss levels on chart.
a) Run e-BJF-TrailingStop-Toolkit expert by StrategyTester
b) Set VisualMode = true
c) Add any graph. object on the chart manual, set name = "!buy". Buy order will be open.
d) Add any graph. object on the chart manual, set name = "!sell". Sell order will be open.
Example Standard Trailing
settings
extern bool StdTrail.On = true
extern int StdTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern int StdTrail.Size = 80; // Keep StopLoss on 80 pips from the market.
// StopLoss updated only to profitable side.
extern int StdTrail.Step = 10; // Update StopLoss every 10 pips
1. Open Sell order
2. Modifiy sell order and add SL =80 pips (profit > 50 pips)
3. Move SL on 10 pips (several times)
4. Close order by SL
SL Modification Journal
Trailing StopLoss with Vizaulization
Expert Advisor TrailingStop-Toolkit Options
--- Common ---
extern int AccDigits = 5; // Set 4 or 5
--- Work days ---
extern bool MondayOn = true;
extern bool TuesdayOn = true;
extern bool WednesdayOn = true;
extern bool ThursdayOn = true;
extern bool FridayOn = true;
extern bool SaturdayOn = false;
extern bool SundayOn = false;
// Work days of the week
--- Work time ---
extern string WorkTime1 = "0:00-24:00";
extern string WorkTime2 = "0:00-24:00";
extern string WorkTime3 = "0:00-24:00";
// Trade time. You can specify 3 different trade sessions.
// ServerTime is used.
--- Standard Trailing ---
extern bool StdTrail.On = false; // Trailing on/off
extern int StdTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern int StdTrail.Size = 30; // Keep StopLoss on 30 pips from the market.
// StopLoss updated only to profitable side.
extern int StdTrail.Step = 5; // Update StopLoss every 5 pips
--- High/Low Trailing ---
extern bool HLTrail.On = false; // Trailing on/off
extern int HLTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern int HLTrail.Bars_timeframe = 0;
// 0 is the current TimeFrame of the chart
// For timeframes details see programming language for MT4 help of MT4:
// programming language for MT4 Reference - Standard constants - Timeframes
extern int HLTrail.Bars_shift = 1; // Get High/Low from the first closed bar (shift = 1)
extern int HLTrail.ExtraPips = 0; // Add this pips value to High or Low on StopLoss calculation
--- ATR Trailing ---
extern bool ATRTrail.On = false; // Trailing on/off
extern int ATRTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern int ATRTrail.ATR_timeframe = 0;
// 0 is the current TimeFrame of the chart
// For timeframes details see programming language for MT4 help of MT4:
// programming language for MT4 Reference - Standard constants - Timeframes
extern int ATRTrail.ATR_period = 10; // Period of ATR indicator
extern int ATRTrail.ATR_shift = 1; // Get ATR value from the first closed bar (shift = 1)
extern int ATRTrail.ExtraPips = 0; // Add this pips value to ATR on StopLoss calculation
--- Fractals Trailing ---
extern bool FrTrail.On = false; // Trailing on/off
extern int FrTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern int FrTrail.Fr_timeframe = 0;
// 0 is the current TimeFrame of the chart
// For timeframes details see programming language for MT4 help of MT4:
// programming language for MT4 Reference - Standard constants - Timeframes
extern int FrTrail.ExtraPips = 0; // Add this pips value to Upper/Lower Fractal on StopLoss calculation
--- PSAR Trailing ---
extern bool PSARTrail.On = false; // Trailing on/off
extern int PSARTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern int PSARTrail.PSAR_timeframe = 0;
// 0 is the current TimeFrame of the chart
// For timeframes details see programming language for MT4 help of MT4:
// programming language for MT4 Reference - Standard constants - Timeframes
extern double PSARTrail.PSAR_step = 0.02;
extern double PSARTrail.PSAR_maximum = 0.2; // PSAR attributes
extern int PSARTrail.ExtraPips = 0; // Add this pips value to PSAR on StopLoss calculation
--- ProfitPcnt Trailing ---
extern bool PPcntTrail.On = false; // Trailing on/off
extern int PPcntTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern double PPcntTrail.ProfitPcnt = 40.0; // Everytime lock 40 % of profit reached
New options:
--- TrendLine Trailing ---
extern bool TLineTrail.On = false; // Trailing on/off
extern string TLineTrail.ObjName = "MyTrendLine"; // name of TrendLine object (you need to add it manual)
extern int TLineTrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
extern double TLineTrail.ExtraPips = 0; // Add this pips value to TrendLine on StopLoss calculation
Vizualization
extern bool SLTracks.Draw = true;
extern color LongSLTrack.color = DodgerBlue;
extern int LongSLTrack.style = STYLE_SOLID;
extern int LongSLTrack.width = 2;
extern color ShortSLTrack.color = Red;
extern int ShortSLTrack.style = STYLE_SOLID;
extern int ShortSLTrack.width = 2;
MovingAverage Trailing
MATrail.On = false; // MA Trailing on/off
MATrail.ProfitReq = 50; // Minimum profit to activate the trailing, pips
MATrail.Step = 5; // Trailing step (move StopLoss every 5 pips)
MATrail.MA_timeframe = 0;// 0, 1, 5, 15, 30, 60, 240, 1440, 10080 or 43200
MATrail.MA_period = 20;// MA period
MATrail.MA_shift = 0;// MA shift, bars (omly positive values or 0 allowed)
MATrail.MA_method = MODE_EMA;// MODE_SMA, MODE_EMA, MODE_SMMA or MODE_LWMA
MATrail.MA_applied_price = PRICE_CLOSE;
// PRICE_OPEN, PRICE_CLOSE, PRICE_HIGH, PRICE_LOW,
// PRICE_MEDIAN, PRICE_TYPICAL, PRICE_TYPICAL, PRICE_WEIGHTED
MATrail.MA_use_open_bar = false;
// true: get MA value from open bar
// false: get MA value from closed bar
MATrail.ExtraPips = 0;
// Add this pips value to MA on StopLoss calculation
// This is vertical offset of StopLoss from MA
Filters
Filter by tickets
FilterByTickets.On = false;
Ticket1 = -1;
Ticket2 = -1;
Ticket3 = -1;
Ticket4 = -1;
Ticket5 = -1;
Filter by magic numbers
FilterByMagic.On = false;
Magic1 = -1;
Magic2 = -1;
Magic3 = -1;
Magic4 = -1;
Magic5 = -1;
Filter by order comments
FilterByComments.On = false;
Comment1 = "";
Comment2 = "";
Comment3 = "";
Comment4 = "";
Comment5 = "";
Expert Advisor TrailingStop-Toolkit F.A.Q.
Q. Does this EA works per chart or globally? If I'm trading on 2 currency pairs (charts) should I put it on both?
A. This EA has be attached once per chart (but once per pair).
Example: You trade EURUSD M15, EURUSD H1, GBPUSD H1, USDJPY M30. You should attach Trailing EA once on EURUSD chart (does not matter M15 or H1 timeframe), once on GBPUSD and once on USDJPY.
Q. As it is designed I should manually put initial S/L as EA
starts to modify S/L only after reaching profit as required by ProfitReq
param during trade? Is there other way to work around?
A. You can set ProfitReq = -100 or any negative value greater than
еру spread. In this case the trailing will set initial StopLoss automatically.