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

Close_on_PROFIT_or_LOSS_inAccont_Currency - MetaTrader 4 Expert

author EAcpu | 2 reads | 0 comments |

Close_on_PROFIT_or_LOSS_inAccont_Currency - expert for MetaTrader 4

//+----------------------------------------------------------------------------------------------------------------------------------------------------+

//|Accont_Currency_V2 "Profit or Loss" in optimization turned off: New:

//|1. Error handling added: The code includes error handling to handle situations where an order cannot be closed or deleted.

//|2. Code optimization: Optimize the code to avoid duplication and improve readability.

//|3. Efficiency: unnecessary loops or calculations removed.

//|4. Clear all chart objects when deinitializing the EA

//+----------------------------------------------------------------------------------------------------------------------------------------------------+

Close_on_PROFIT_or_LOSS_inAccont_Currency - expert for MetaTrader 4

When set to 0 the EA will perform no action.

Positive_Closure_in_Account_Currency must be higher than the current equity amount, otherwise the transaction will be executed immediately.

Example: Equity is 55000$, Positive_Closure_in_Account_Currency is set to 55500$, 500$ can be obtained

Positive closing of account currency > O && < 55000$ = execution immediately

Negative_Closure_in_Account_Currency must be lower than the current equity amount, otherwise the transaction will be executed immediately.

Example: Equity is 55000$, Negative_Closure_in_Account_Currency is set to 54500$, only 500$ is released

Negative liquidation of account currency >55000$ = execution immediately

Spread spikes can be avoided by reducing the number of spreads, but the market will have its way and higher gains or losses may occur.

Additionally, if the spread is set lower than the average spread of the trading pair, these positions will not be executed.

WARNING: USE OF THIS SOFTWARE IS AT YOUR OWN RISK. The Forex market is very volatile!

#property Copyright "Copyright 2024, MetaQuotes Ltd."

#property link "https://www.mql5.com"

#Attribute version "1.01"

#Attribute description "persinaru@gmail.com"

#property Description "IP 2024 - Free and Open Source"

#property Description "This EA closes all trades with profit and loss in the account currency."

#Attribute description ""

#property Description "Warning: Use this software at your own risk."

#property Description "The creator of this script is not responsible for any damage or loss."

#Attribute description ""

#Attribute strict

#property show_inputs Properties

extern string Closures = "When profit or loss is reached, the EA closes all trades and pending orders. Profits and losses are calculated in the account currency.";

extern int Positive_Closure_in_Account_Currency = 0;

extern int Negative_Closure_in_Account_Currency = 0;

external int spread = 10;


Attachment download

📎 close_on_profit_or_loss_inaccount_currency.mq4 (5.31 KB)

📎 close_on_profit_or_loss_inaccount_currency_v2.mq4 (14.42 KB)

Source: MQL5 #48818

Close_on_PROFIT_or_LOSS_inAccont_Currency - MetaTrader 4 Expert Pre-Use Tips

This page has been supplemented with structured instructions, focusing on the purpose of EA source code, MQL4/MQL5 platform compatibility, testing process and risk control. Before downloading or deploying, it is recommended to first determine whether it is consistent with your own variety, cycle and account environment.

Suitable for who to use

  • Users who want to quickly screen EA source code and are willing to do simulation disk verification first.
  • People who need to compare MT4/MT5 EAs, indicators, scripts or source code projects.
  • Traders who wish to record backtests, parameters and risk boundaries before placing a trade.

Testing and risk control suggestions

  • First verify the default parameters in the strategy tester or demo account, and then adjust the symbol, period, spread and trading period one by one.
  • Scalping, grid, martin, and high-frequency strategies should focus on observing maximum drawdowns, consecutive losses, slippage, and trading frequency.
  • It is not recommended to run any document directly on the real disk. At least observe the simulated disk performance for 2-4 weeks first.

FAQ

Can MT4 and MT5 be used interchangeably?
Usually cannot be used directly. EX4/MQ4 corresponds to MT4, EX5/MQ5 corresponds to MT5, and the source code needs to be compiled in the corresponding MetaEditor.

Is this resource guaranteed to be profitable?
cannot. EAs, indicators and scripts can only be used as trading tools, and the results depend on parameters, market environment, spreads, slippage and risk control.

What else can I continue to watch?
Forex EA download , foreign exchange indicator download , EA evaluation , MQL5 CodeBase .

English Search Notes

This page is also optimized for English search intent around Close_on_PROFIT_or_LOSS_inAccont_Currency - MetaTrader 4 Expert . Related search terms include: MQL4 source code, MQL5 source code. Test any Forex EA, Expert Advisor, MT4/MT5 indicator, script or MQL source code with historical data and a demo account before live trading.

Verification code Refresh