On each new bar/tick, my variable is re-initialed, I am trying to execute a trade once per signal, the problem is that once TP is achieved, if same trends continues, it triggers another trade. I am thinking to store variable in Text file. So just wondering what would the best way to handle such variable. Sorry I don't have code.
问问题
326 次
1 回答
1
MT4 全局变量对象
虽然 MT4 以某种方式支持称为“全局变量”的类似幽灵的半持久性对象,它可以在 MT4 终端重新运行之间存活大约几周,但这些幽灵对于您的草图用途来说相当复杂。
GlobalVariableCheck()
GlobalVariableSet()
GlobalVariableSetOnCondition()
GlobalVariableGet()
文件系统文本文件
虽然可行,但这应该是万不得已的唯一选择,因为这是最慢且最难管理的部分,一旦在同一环境中运行多个单元、数十个、数百个 MT4 终端实例,文件IO 冲突的风险是显而易见的.
解决方案?
尝试创建和维护一个singleton
- 模式以避免多次重新进入您已经进行一次交易的趋势。
尝试为趋势反转设置一个明确的定义,singleton
一旦形成新趋势,就会停止/重置 - 模式。
于 2015-10-30T22:44:09.977 回答