checking for realtime profits

 

Hi, im trying to check for realtime profit levels during trade.

Here is my code it gives profit after trade close.


for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

iTotalTrades = OrdersTotal();
if (OrderType()==OP_BUY) {Profit=Bid-OrderOpenPrice();}
if (OrderType()==OP_SELL) {Profit=OrderOpenPrice()-Ask;}

if (SymDigits == 5) { Profit=Profit*10000;}
if (SymDigits == 3) { Profit=Profit*100;}
}
Print(" **** Profit - iTotalTrades **** ",Profit," ",iTotalTrades );

 

would OrderProfit() do the trick? That gives you a profit in your deposit currency.

 

I tried using this and it shows profit after orderclose.

I want to add buy/sell order after profit level >200 pips.

The profit levels per tick is what I'm seeking.

Thanks for any help.

 
for(int i = 0; i < OrdersTotal(); i++)
   {
   OrderSelect (i, SELECT_BY_POS, MODE_TRADES);

   if (OrderSymbol() == Symbol() && OrderType() == OP_BUY)
      {
      if (OrderClosePrice() >= OrderOpenPrice() + 200*Point)
         {
         OrderSend(......);
         }
      }
   }
& of course u need to adjust to 4/5 digit
Reason: