Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 801

 

There isa tickvalue in the declared variables, but it is not involved in the calculation.Where should it be?

  double lots_bzu = 0;
  double sum_bzu = 0;
  double tickvalue=MarketInfo(Symbol(),MODE_TICKVALUE);
  double price_bzu_o = 0;
  for (double i_bzu = 0; i_bzu < OrdersTotal(); i_bzu++)
  {
   if ( !OrderSelect ( i_bzu , SELECT_BY_POS , MODE_TRADES )) break;
   if ( OrderSymbol () != Symbol()) continue;

   if ( OrderType () == OP_BUY)
   {
    lots_bzu = lots_bzu + OrderLots ();
    sum_bzu = sum_bzu + OrderLots () * OrderOpenPrice ();
   }

   if ( OrderType () == OP_SELL )
   {
    lots_bzu = lots_bzu - OrderLots ();
    sum_bzu = sum_bzu - OrderLots () * OrderOpenPrice ();
   }
   
   price_bzu_o = 0;
   if (lots_bzu != 0 )
   price_bzu_o = sum_bzu / lots_bzu;                                  // уровень общего безубытка
  }
 
yiduwi:

There isa tickvalue in the declared variables, but it is not involved in the calculation.Where should it be?

when determining the breakeven level tickvalue is required to account for swap and commissions in that very level.

But in the code you took it is not there, maybe the transactions are fast, swaps are not formed or are extremely small, so you can just comment it out ;-)

 
Maxim Kuznetsov:

when determining the breakeven level tickvalue is required to account for swap and commissions in that very level.

but in the code you took it is not there, probably transactions are fast, swaps are not formed or are very small, so you can just comment it out;-)

Thank you) Swap and commission are written in the variablesumsvop, how to take into account swap and consequently where is this tick price?

double sumsvop = 0;
  double tickvalue=MarketInfo(Symbol(),MODE_TICKVALUE);
  
  for (int i_bzu = 0; i_bzu < OrdersTotal(); i_bzu++)
  {
   if ( !OrderSelect ( i_bzu , SELECT_BY_POS , MODE_TRADES )) break;
   if ( OrderSymbol () != Symbol()) continue;
   if ( OrderType () == OP_BUY)
   {
    lots_bzu = lots_bzu + OrderLots ();
    sum_bzu = sum_bzu + OrderLots () * OrderOpenPrice ();
    sumsvop+=OrderSwap()+OrderCommission();                            //Swap

   }

   if ( OrderType () == OP_SELL )
   {
    lots_bzu = lots_bzu - OrderLots ();
    sum_bzu = sum_bzu - OrderLots () * OrderOpenPrice ();
    sumsvop+=OrderSwap()+OrderCommission();                            //Swap

   }
   
   price_bzu_o = 0;
   if (lots_bzu != 0 )
   price_bzu_o = sum_bzu / lots_bzu;                                  // уровень общего безубытка
  }
 
yiduwi:

Thank you), how do you account for the swap and consequently where does this tick price go?

think about it.

You have the volume of the position and you know its loss on the balance sheet (swaps and commissions). How many points should be corrected?


 
Maxim Kuznetsov:

Think about it.

You have the volume of the position and you know the loss on the balance sheet (swaps and commissions). How many points should be adjusted?


It is clear that swaps and commissions should be adjusted in points. How does the price of a tick affect this?

 
yiduwi:

It is clear that swap and commission need to be translated into points. How is the price of a tick involved?

Just point the F1 at
MODE_TICKVALUE

You have it in your code. And it was its application that raised the question.

 
Maxim Kuznetsov:
already push the F1 to

You have it in your code. And it was its application that raised the question.

So I'm asking how it(tickvalue) is involved in the formula for converting money into points.

double tickvalue=MarketInfo(Symbol(),MODE_TICKVALUE);
 
Hi. Does anyone have an indicator that writes volume on the chart of open orders? Or tell me how
 

I have tick quotes in csv format, how can I get them into MT5 tester?

There is a cool csv2fxt script for MT4 for example, is there an analogue for 5?

 
Hello! In the settings of the terminal Service-Settings-Advisors you can add a link to the trusted area in WebRequest..... can you remove it from there? Even after editing it is still running and cannot be removed from the terminal...
Reason: