Skip to content

ForexRobotEasy/Ultimate-Trailing-Stop-EA-MT5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Ultimate Trailing Stop EA MT5

This code is an Expert Advisor (EA) for MetaTrader 5 (MT5) that implements an advanced trailing stop functionality for forex trading. The EA is designed to manage open positions by applying various trailing stop methods, checking for stop loss, take profit, and breakeven levels, and partially or fully closing positions as necessary.

Features

  • Stop Loss: Set the stop loss value in pips.
  • Take Profit: Set the take profit value in pips.
  • Breakeven Trigger: Set the breakeven trigger in pips.
  • Partial Take Profit Levels: Set three partial take profit levels in pips.
  • Partial Close Percentage: Set the percentage of position to partially close.
  • Trailing Stop: Choose between using a real trailing stop or a virtual trailing stop.
  • Trailing Stop Method: Select the trailing stop method (fixed, percent, ATR Exit, etc.).
  • Full Exit On Touch: Option to fully exit the position when the trailing stop is touched.
  • Partial Close On Touch: Option to partially close the position when the trailing stop is touched.
  • Full Exit On Bar Close: Option to fully exit the position when the bar closes.
  • Partial Close On Bar Close: Option to partially close the position when the bar closes.

How It Works

The EA is initialized using the OnInit() function and deinitialized using the OnDeinit() function. The main logic of the EA is executed in the OnTick() function, which is called on each tick of the market.

In the OnTick() function, the EA checks for open orders, applies the chosen trailing stop methods, checks for stop loss, take profit, and breakeven levels, partially closes positions if necessary, and fully exits positions if necessary.

The trailing stop methods are implemented in the ApplyTrailingStop() function, which applies the chosen trailing stop method based on the input parameters.

The stop loss, take profit, and breakeven levels are checked in separate functions: CheckStopLoss(), CheckTakeProfit(), and CheckBreakeven(). These functions compare the current price with the levels defined in the input parameters and take appropriate actions if the levels are reached.

The partial close functionality is implemented in the PartiallyClosePosition() function, which calculates the position size to partially close based on the chosen percentage and closes the specified portion of the position.

The full exit functionality is implemented in the FullyExitPosition() function, which closes the entire position.

Product Description

Ultimate Trailing Stop EA MT5 is an advanced forex trading tool that helps traders manage their open positions effectively. With features like stop loss, take profit, breakeven trigger, partial take profit levels, and trailing stop methods, this EA provides comprehensive control over open positions.

The EA allows traders to set their desired stop loss and take profit levels in pips, ensuring that positions are automatically closed when these levels are reached. It also offers the option to set a breakeven trigger, which moves the stop loss to the entry price when a specified profit level is reached, minimizing the risk of losing profits.

Traders can take advantage of three partial take profit levels, which allow them to close a portion of the position at predefined profit levels. This feature helps secure profits while still keeping a portion of the position open for potential further gains.

The EA offers flexibility in choosing between a real trailing stop or a virtual trailing stop. Traders can select the trailing stop method that best suits their trading strategy, such as fixed, percent, or ATR Exit.

For added convenience, the EA provides options to fully exit or partially close positions when the trailing stop is touched or when the bar closes. This allows traders to customize the exit strategy based on their preferred trading style.

Please note that ForexRobotEasy is not the official developer of this product. We only provide a sample code that demonstrates the functionality described in this product. To find the official developer of this product, please refer to MQL5. For detailed reviews and trading results of this product, please visit forexroboteasy.com.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published