selecting last open position
MA
From the code we see, this is wrong...
if(order_type==OP_BUY)
should be...
if(OrderType()==OP_BUY)
FWIW
-BB-
I forgot to mention that I had defined at the beginning the following:
int order_type order_type=OrderType()
Nevertheless i deledted the above lines from my EA and replaced order_type by OrderType() and it worked ! (dunno with though)
So thx for your help it works now.
MovingAverage
MA
> I had defined at the beginning...
order_type=OrderType()
This would only work if done within the {} after the OrderSelect()...
-BB-
ok thx for the tip BarrowBoy.
Dear All,
The system I am coding open only one position at a time. This condition is closed later on following a few rules.
In order to select this unique open position and apply the closing rules I use the following code:
Sometimes the open position is short, but the EA prints "OP_BUY" and vice versa, so in fact using this code the behavior is totally random.
I guess I am missing something, I am trying to find a simple way to do that, anyone can point me to the right direction?
Maybe I did not write the following line well ?
there is only 1 position open at a time.
May thx and regards,
Movingaverage