This is closing partial lots BUT...not exactly doing what I expected. Maybe you can see the issue here.
should close 1 lot when there is a BUY and the price goes .00071(just a random number i'm testing on a 1 minute chart)
or close 1 lot when there is a SELL and price goes .00071 down
using a 5 digit broker by the way. There is only 1 trade ever open and only by this EA, so no scrolling through orders
THANKS for HELP!
if (IsConnected() && IsTradeAllowed()) while (IsTradeContextBusy()) Sleep(75);
if (OrdersTotal()>0) {OrderSelect(0, SELECT_BY_POS,MODE_TRADES);
RefreshRates();
if (Ask >= (OrderOpenPrice()+ (.00071)) && OrderLots() == 2 && (OrderType() == OP_BUY)) {
OrderClose(OrderTicket(),1,Ask,10,Red); }
if (Bid <= (OrderOpenPrice()- (.00071)) && OrderLots() == 2 && (OrderType() == OP_SELL)) {
OrderClose(OrderTicket(),1,Bid,10,Blue); }}
should close 1 lot when there is a BUY and the price goes .00071(just a random number i'm testing on a 1 minute chart)
or close 1 lot when there is a SELL and price goes .00071 down
using a 5 digit broker by the way. There is only 1 trade ever open and only by this EA, so no scrolling through orders
THANKS for HELP!
if (IsConnected() && IsTradeAllowed()) while (IsTradeContextBusy()) Sleep(75);
if (OrdersTotal()>0) {OrderSelect(0, SELECT_BY_POS,MODE_TRADES);
RefreshRates();
if (Ask >= (OrderOpenPrice()+ (.00071)) && OrderLots() == 2 && (OrderType() == OP_BUY)) {
OrderClose(OrderTicket(),1,Ask,10,Red); }
if (Bid <= (OrderOpenPrice()- (.00071)) && OrderLots() == 2 && (OrderType() == OP_SELL)) {
OrderClose(OrderTicket(),1,Bid,10,Blue); }}
taking series 3 and 34