MQL4:每个信号/事件单个交易的全局趋势/变量或文本文件

时间:2015-10-30 11:38:11

标签: mql4 metatrader4 forex mt4

在每个新的柱/刻度线上,我的变量被重新初始化,我试图每个信号执行一次交易,问题是一旦达到TP,如果相同的趋势继续,它会触发另一次交易。我想将变量存储在Text文件中。所以只是想知道处理这种变量的最佳方法是什么。对不起,我没有代码。

1 个答案:

答案 0 :(得分:1)

MT4 Global Variable objects

While MT4 supports somehow ghost-alike semi-persistent objects called "Global Variables", that can survive between MT4 Terminal re-runs for about several weeks, these ghosts are rather complicated to be used for your sketched purposes.

GlobalVariableCheck()
GlobalVariableSet()
GlobalVariableSetOnCondition()
GlobalVariableGet()

FileSystem Text-File

While doable, this ought be a last resort only option, as this is the slowest and the least manageable part, once running several units, several tens, several hundreds of MT4 Terminal instances in the same environment, the risk of fileIO collisions is clearly visible.


Solution?

Try to create & maintain a singleton-pattern to avoid multiple re-entries into a trend you have already put one trade into.

Try to setup also a clear definition for trend reversals, which stop / reset the singleton-pattern once a new trend was formed.