closing an open order when...

 
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.
 
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.