Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Scripts

VPS Trailing Stop Service - script for MetaTrader 5

Views:
5341
Rating:
(8)
Published:
2023.04.26 08:15
Updated:
2023.04.26 10:03
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Service

Place the file into Services Terminal Folder.

Example

The picture above shows an example of setting up a new sell order with the corresponding comment - 1800 points.

Comment

The picture above shows the result of sell order the corresponding comment - 1800 points.

Example

The picture above shows an example of setting up a graphical object of a horizontal line - 450 points.

Example

The picture above shows an example of the result of creating a horizontal line.


To use Real SL Trailing - when you open a trade order in the comment indicate the real stop loss distance in points. 

To use Virtual SL Trailing - create horizontal line on same symbol chart then rename it to the name you used before launching the program and in the description of the object indicate the virtual stop loss distance in points. 

!!! Be careful !!!

When placing an object on chart use correct SL distance depending on trade direction.

To disable virtual trailing just delete created horizontal line.

To disable real trailing you have to stop this program.

This code is designed to manage only one open position per symbol.

To manage a large number of open positions for a single symbol, you need to edit the code.

    CheckTrades CheckTrades

    This code initializes the necessary objects and input parameters, and defines a CheckTrades() function that calculates the risk and profit amounts based on the account balance and user input. It then iterates through open orders and checks if the current profit or loss meets the user-defined thresholds, and closes the position if necessary

    Risk Calculator Risk Calculator

    Calculates the risk in the account currency for a given trading volume of the selected symbol at different time periods.

    Expert Advisor for Opening Multiple Buy and Sell Orders Based on User Input Expert Advisor for Opening Multiple Buy and Sell Orders Based on User Input

    This MT5 Expert Advisor opens multiple buy and sell orders based on user input, featuring a simple interface with Buy and Sell buttons. The EA calculates lot size, checks the spread against slippage, and places orders accordingly. It is essential to test this EA in a demo account before using it in live trading.

    Dynamic Trailing Stop Loss and Profit Target Management Dynamic Trailing Stop Loss and Profit Target Management

    This code snippet implements a dynamic risk management strategy for existing trades. It focuses on closing trades based on profit or loss thresholds and employs a trailing stop loss to lock in profits as the trade moves favorably. The strategy helps manage risk and enhance profitability in a streamlined manner.