Hidden Stop Loss and Take Profit System

Hidden Stop Loss and Take Profit System
DOWNLOAD all MT4 librarys (97)
YouTube Video Thumbnail

Similar MetaTrader Tools

Hidden Stop Loss and Take Profit System

Info

The Hidden Stop Loss and Take Profit System is a Library for MetaTrader 4 that the attached files represent a class system that can be used to simulate a hidden stop loss and take profit system, however in addition to this, it also creates a live stop loss and take profit on the trade just in case the connection between the client and broker server goes down. There are also 4 example EAs.

Usage

This tool is typically used for enhancing chart analysis and decision making.

Platform

This Library works exclusively on MetaTrader 4 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL4/Libraries folder via File ? Open Data Folder in MetaTrader 4.


How to Install and Use Hidden Stop Loss and Take Profit System

1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.

2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.

3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.

4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.

Frequently Asked Questions

Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.

Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.

Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.

What this tool does

The attached files represent a class system that can be used to simulate a hidden Stop Loss and Take Profit system, however in addition to this, it also creates a live Stop Loss and Take Profit on the trade just in case the connection between the client and broker server goes down.

Typical Use Case

This Library excels in automated trading and technical analysis on MetaTrader 4.

Compatible Platform & Setup

This Library works on MetaTrader 4. Place the file in the MQL4/Libraries folder and restart the terminal.

Description & Settings

Related: Function library for maintaining positions with a simple trailing stop - another powerful library for MetaTrader 4 traders.


Also recommended: Break Even&Trailing Stop - similar library with strong performance on MetaTrader 4.

The attached files represent a class system that can be used to simulate a hidden Stop Loss and Take Profit system, however in addition to this, it also creates a live Stop Loss and Take Profit on the trade just in case the connection between the client and broker server goes down. There are also 4 example EAs. A basic description of how the system works is as follows:

A class object is created with the trade characteristics that are required.

A set of functions that are very similar to the OrderSend, OrderModify and OrderClose functions have been provided in the class for opening the trade.

The class records the hidden Stop Loss and hidden Take Profit.

The idea was to choose a level for Live Spread that will be large enough to cover any changes in the spread for Stop Loss hunting, but also any changes in the Stop Level and Freeze Level that may occur.

I would suggest recording the spread, Stop Level and Freeze Level over a week and recording the difference between the minimum and maximum of these values. The Live Spread should be set so that it is greater than these differences.
To get the system to work please use the following procedure:

Add GlobalChartFunctions, C_Trade, C_Trade_TrailingStop Loss, C_Trade_SteppedStop Loss, C_Trade_Pending into the include directory.

Add C_Trade_BasicExample_1, C_Trade_TrailingStop Loss_2, C_Trade_SteppedStop Loss_3, C_Trade_Pending_4 into the Experts directory.

If you want to move the files to a different location, you may need to adjust the include files.

Compile the EA's and test them.
This system has only had some basic testing. It has not been tested in a live environment or incorporated into practical trading system yet, so please take great care and beware that bugs may exist.
I consider this a work in progress that I hope to improve upon later, when I have more time available.

You may also like: Stop Loss Calculation - excellent alternative for library users on MetaTrader 4.

Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
RobotFX does not own any of the code provided on this platform. All tools are freely available on the internet; we simply index and re-offer them for download. We are not responsible for any financial losses that may occur. Trading responsibilities rely solely on the traders downloading and using the displayed Expert Advisors, indicators, and scripts. These tools are provided for educational purposes only and may require modification or optimization to align with a trader's specific strategy or needs.
© ROBOTFX - Best MetaTrader Expert Advisors & Indicators