MQL4 - automated forex trading   /  

Forum

help please

Back to topics list To post a new topic, please log in or register

avatar
14
shadow 2006.09.13 17:03 
nead help: i want to evaluate the profit results (if have 5 losses in row want to excicute order to stop trade)

have any advice please
Terminal Service Client. How to Make Pocket PC a Big Brother's Friend

Terminal Service Client. How to Make Pocket PC a Big Brother's Friend

The article describes the way of connecting to the remote PC with installed MT4 Client Terminal via a PDA.


avatar
79
riyo 2006.09.15 05:31 
int losses = 0;
for(int i=HistoryTotal()-1;i>=0;i--)
        {
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
         if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
         if(OrderProfit()>0 || losses>=5 ) break;
         if(OrderProfit()<0) losses++;
        }

if (losses >= 5) 
{
	// CLOSE ALL ORDERS HERE
	...
}

Back to topics list  

To add comments, please log in or register