MQL4 - automated forex trading   /  

Forum

closing an open order when...

Back to topics list To post a new topic, please log in or register

avatar
2
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.
article

Forex Trading ABC

Working on financial markets represents, first of all, trade operations. We all, starting from the very childhood, have an intuitive idea of what is to buy and to sell. But Forex trading is still something special. This article deals with the ideas necessary to explain some terms. We will also consider the MQL 4 functions that correspond with those terms.


avatar
7
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.
Back to topics list  

To add comments, please log in or register