|
enhanced take profit loop
well i try to encode a simple loop that compares incoming tick to previous one. This in order to enhanced take profit limit . clearly when go long for example and price going above tp price the loop start and go on until bid going up, and break when bid going down . once breaked ea close position. I coded this:
if(TP_ameliore==true && OrderSelect(ticket,SELECT_BY_TICKET)==true)
if (Bid>(OrderOpenPrice()+takeprofit*Point) && OrderType()==OP_BUY)
for(int i=0;i<=1000;i++)
{
double previous_tick_on_bid=Bid;
while (RefreshRates()==false)
{
if(Bid<previous_tick_on_bid)
OrderClose(ticket,lots,Bid,3,Black);
}
}
but when backtesting ea open position but dont close the trade.
Is there someone who have any good suggestion. Thanks in advance
Logan
|