I'm working on an EA to enter in either long or short situations. As part of the development I've split it apart as I focus on one direction at a time. So far, it will enter a trade but will not exit.
The close command for the Long version is below. Note that the Long and Short entry option is why the magic number is set up this way. magicnolong will be 2222 while magicnoshort will be 1111.
I'm pretty new to MetaEditor and have been learning as best as I can but am stuck on this point. ... probably something pretty simple. Would appreciate any help you can provide.
// --------------------
// check condition to close trade
int TradeClose=0;
if(magicnolong==2222 && Bid<SAR0)TradeClose=1;
// check if open trade should be closed
if (OrderFind(magicnolong))
if(ClosingConditions==1 && glbOrderType==OP_BUY && TradeClose==1)
OrderClose(magicnolong, Lots, Bid, 3, CLR_NONE);
return(0);
}
// --------------------
Thank you ...
Pip Parade
The close command for the Long version is below. Note that the Long and Short entry option is why the magic number is set up this way. magicnolong will be 2222 while magicnoshort will be 1111.
I'm pretty new to MetaEditor and have been learning as best as I can but am stuck on this point. ... probably something pretty simple. Would appreciate any help you can provide.
// --------------------
// check condition to close trade
int TradeClose=0;
if(magicnolong==2222 && Bid<SAR0)TradeClose=1;
// check if open trade should be closed
if (OrderFind(magicnolong))
if(ClosingConditions==1 && glbOrderType==OP_BUY && TradeClose==1)
OrderClose(magicnolong, Lots, Bid, 3, CLR_NONE);
return(0);
}
// --------------------
Thank you ...
Pip Parade