![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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