Mastering the STP-Entry Framework for MetaTrader 4: A Trader's Guide

Mike 2010.11.22 18:31 15 0 0
Attachments

Author:
Cheftrader*

Description:
Here’s a solid framework designed for traders looking to build and test systems that leverage stop orders for entering positions. This system operates on a daily basis, allowing you to adjust the entry logic (STP-value calculation) with ease through the .mqh file.

Key Features:

  • Risk management with options to enable or disable trailing stops
  • Money management that adjusts position sizes based on account profitability
  • Ability to cancel pending orders at a specified time
  • Close positions after a set duration since opening
  • Filtering methods for optimization, such as analyzing trade results based on the day of the week
  • Email notifications for significant equity changes

Recommendations:

  • Optimize long and short parameters separately (e.g., side=-1)
  • Start with a simple concept: for example, place a sell-stop at yesterday's low (see sample in .mqh file)
  • Test and optimize with a lot size of 0.1, without money and risk management (maxLot=0.1). This way, your payoff in the tester is scaled in pips
  • Begin by testing automatic position closures after 1 hour or another defined live duration (closetimeperiod = 3600)
  • If your entry strategy proves successful, forego duration-based closures and focus on optimizing risk management parameters (SL, TP, SLslope)
  • Assess your system's stability on specific days of the week: Set the day filter to 1 for placing STP-entry orders only on Mondays.
  • Finally, evaluate your money management settings (maxLot, PercentOfProfit)
extern double SL           = 8;    // StopLoss in Basepoints (1/10000 for JPY)
extern double TP           = 20.5;// TakeProfit in Basepoints
extern double SLslope      = 0.8  // Trailing stop utilizes a part [e.g., 0.8] of the trade profit
                                   // If > 1.0, trailing stops are turned off
extern int side            = -1   // LONG = 1, SHORT = -1, 0 for both directions
extern int PercentOfProfit = 30   // Risk [%] of the profit already achieved in the account, used for position size calculation
extern double MaxLot       = 10.0; // Maximum lot for trading
extern int dayfilter       = 7    // Place pending orders every day = 7 or only on specific days (1 for Monday to 5 for Friday)

* This EA took inspiration from the work of RomanY.

You can find additional resources at: MQL4 Codebase

STP-Entry Framework in Action

List
Comments 0