| / | Forum |
|
mcsqueeze
2006.03.22 04:34
i need to write some code that will close an order of the current close is x points
less than the current high. or vice versa
i tried if (close[0] + spike *point)< high[0]) where spike is an external double variable. similar to a stoploss variable. |
|
Error 146 ("Trade context busy") and How to Deal with It The article deals with conflict-free trading of several experts on one МТ 4 Client Terminal. It will be useful for those who have basic command of working with the terminal and programming in MQL 4. |
|
Fishtank
2006.03.23 00:33
I am pretty sure that Close[0], is the current bid. If you were to use Close[1]
and High[1], your paramters would be checked on the first tick of the new
bar...which will be the same value as Close[0]. the only reason I say that
is because reading through posts over the past few months there have been a few
on how Close[0] is somewhat unreliable to use.
From what your first line says I would probably write something like if ((High[1] - Close[1]) > X) { OrderClose(etc, etc, etc,) } The advisor would evaluate that at the same price point as Close[0]. Because it would check it on the first tick of the new bar.(Open[0] = Close[1]) Unless the price jumps which is pretty rare. If somebody knows otherwise please let me know because i would have to make some changes myself!!! But it works well in my experience. |