此资源为星钻会员专享,每日更新,收录于《大白EA宝库:星钻会员专属合集》。
当账户盈利/亏损达到以账户货币计的设定金额时,这个 EA 会关闭所有交易与挂单;设为 0 则不动作。本帖文件为 MT4 源码,打包成 zip 下载,解压后在 MetaEditor 里编译使用,参数与文件开头见下方源码预览。
源码预览(先看代码,再决定下不下)
本帖是源码 EA:Close_on_PROFIT_or_LOSS_inAccont_Currency.mq4,全文共 111 行。下面是它的全部可调参数与文件开头,完整源码在上方下载区,星钻会员可见。
可调参数(4 个)
string Closures = "EA closes all trades and pending orders when a profit or loss is reached. Profit and Losses are calculated in Account Currency."int Positive_Closure_in_Account_Currency = 0int Negative_Closure_in_Account_Currency = 0int Spread = 10
//+------------------------------------------------------------------+ //| Close_on_PROFIT_or_LOSS_inAccont_Currency.mq4 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.b123.com/ | //+------------------------------------------------------------------+ //+------------------------------------------------------------------------------------------------------------------------------+ //|At 0 set EA will do nothing. //| //|Positive_Closure_in_Account_Currency must be higher than the current Equity amount, otherwise, the trades will be executed imme //|Example: Equity is 55000$ and Positive_Closure_in_Account_Currency set to 55500$ to gain 500$ //| //|Negative_Closure_in_Account_Currency must be lower than the current Equity amount, otherwise, the trades will be executed immed //|Example: Equity is 55000$ and Negative_Closure_in_Account_Currency set to 54500$ to loose only 500$ //| //|Spread spikes can be avoided by reducing the spread number but the market will do what it wants and higher gains or losses can //| //|Also if the spread is set lower than the average spread for the pairs traded those positions will not be executed. //| //|WARNING: Use this software at your own risk. The Forex market is very volatile! //+------------------------------------------------------------------------------------------------------------------------------+ #property copyright "Copyright 2024, MetaQuotes Ltd." #property link "https://www.b123.com/" #property version "1.01" #property description "https://www.b123.com/" #property description "IP 2024 - free open source" #property description "This EA closes all trades on Profit and Losses calculated in Account Currency." #property description "" #property description "WARNING: Use this software at your own risk." #property description "The creator of this script cannot be held responsible for any damage or loss." #property description "" #property strict #property show_inputs
风险提示:EA 交易有风险,过往与参数表现不代表未来。正式使用前先在模拟盘跑够样本,确认在自己的点差、滑点环境下仍符合预期,再决定是否上实盘。
版本说明:资源随 MT4/MT5 版本迭代可能失效,如遇失效请在本帖留言反馈。

