Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Script for opening short positions - MetaTrader 5 script | Trading script download - MT4/MT5 resources

author EAcpu | 2 reads | 0 comments |

These scripts are designed to sell with fixed stop loss and take profit pip values ​​at the current price. There are four variations of the script, which can be divided into two groups:

The first set of scripts are OpenSellPosition.mq5 and OpenSellPosition_X.mq5. The second set of scripts ends with the ECN file name. They are OpenSellPosition_ECN.mq5 and OpenSellPosition_X_ECN.mq5.

All scripts are designed to sell with fixed stop loss and take profit pip values ​​at the current price.

The main advantage of the OpenSellPosition and OpenSellPosition_ECN scripts is the ability to fix the volume based on the size of the entire deposit using the MM (Money Management) script input parameter, which defines the ratio of the volume of equity involved in the trade to the equity of the entire deposit:

OpenSellPosition and OpenSellPosition_ECN script input parameters:

 //+------------------------------------------------------------------------+
//|Script input parameters |
//+------------------------------------------------------------------------+
Enter double MM= 0.1 ; // Money Management
Input integer deviation = 10 ; // price deviation
Enter an integer Stop loss = 300 ; // Stop loss points at the current price
Enter an integer Take Profit = 800 ; // Profit in points from the current price
Enter the total time in units = 4 ; // Number of retries for unsuccessful transactions
Input unit sleep time = 1 ; // Pause time between retries (in seconds)

The main advantage of the OpenSellPosition_X and OpenSellPosition_X_ECN scripts is the ability to fix trade losses when the stop loss is triggered based on the entire deposit size using the LossMM script input parameter, which defines the equity volume ratio of the total deposit equity loss when the stop loss is triggered:

OpenSellPosition_X and OpenSellPosition_X_ECN script input parameters:


Attachment download

📎 opensellposition.mq5 (15.46 KB)

📎 opensellposition_x.mq5 (16.47 KB)

📎 opensellposition_ecn.mq5 (18.06 KB)

📎 opensellposition_x_ecn.mq5 (19.07 KB)

Source: MQL5 #1575

Verification code Refresh