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

 
Alexander Avksentyev #:

I agree, I read the reference.

Multiplied the profit by Point and got 0.00001 or less.

It's a strange thing to do

 
Alexander Avksentyev #:

Another question

Is the profit calculation in pips an OrderProfit * Point .

The price can pass 20 pips and give 50$ profit.

It can pass in 5 points, but the profit will be $80

This is the same for each symbol, with the franc the profit will be bigger than with the canadian in the same passing in pips

 
Artyom Trishkin #:

Why not right away?

I wrote a simple example online. I didn't even go into the editor. Alexander is a novice programmer and he doesn't need any extra complexity. Have a look at his code above. But if we're talking about developing a multisymbol robot, you can use SymbolInfoDouble. Who prevents you from doing that?

 
Mihail Matkovskij #:

The SymbolInfoTick function writes tick data to a specialMqlTick structure, from the fields of which it can be retrieved.

thanks to

 

Another question came up

I made the inscription in the corner

//+-----------------------------------------------------------------------------------------------+
int OnInit()
  {
Start          = TimeCurrent();
MaxMartinLot   = Lot*MathPow(1.4,OrdersClose);
MaxMartinLot2  = Lot*MathPow(K_Martin2,OrdersClose2);
AC             = StringConcatenate(" ", AccountCurrency());
int Y          = 20;
DrawLABEL("lab_Take",1,5,Y,clrLime,"LOT: "); 
return(INIT_SUCCEEDED);
  }
//+-----------------------------------------------------------------------------------------------+
void OnDeinit(const int reason)
  {

  }
//+-----------------------------------------------------------------------------------------------+
void OnTick()
  {
// Получим значение индикатора
   dMA = iMA(Symbol(), 0,PeriodMA, MovingShift, MODE_SMA, PRICE_CLOSE, 0); // MODE_SMA - простое усреднение , значение 0. PRICE_CLOSE- цена закрытия, значение 0.

// Если нет открытых ордеров, то входим в условие
      if(CountOrders()==0)
     {
// Если появился сигнал на покупку, то откроем ордер на покупку
      if(bSignalBuy() == true)
         vOrderOpenBuy();

// Если появился сигнал на продажу, то откроем ордер на продажу
      if(bSignalSell() == true)
         vOrderOpenSell();
     }
       DrawLABEL("lab_Take",1,5,0,Color(),StringConcatenate("LOT: ",DoubleToStr(LOT(),2)));  
  }

in the yellow line gives this warning:

possible loss of data due to type conversion

It looks like I mixed them up.

everything is working

if there is no transaction, only one colour is on

if there is a deal opened - lights up another colour

Color() set it this way:

double Color()
  {
   double CL =clrRed;
   if(CountOrders()==0) CL =clrYellow;
   return(CL);
  }
Please check it out.
 
законопослушный гражданин possible loss of data due to type conversion

It looks like I mixed them up.

everything is working

if there is no transaction, only one colour is on

if there is a deal opened - lights up another colour

Color() set it this way:

Please check it out.

The function Color should return color, not double.

color Color()
  {
   color CL = clrRed;
   if(CountOrders() == 0) 
     CL = clrYellow;
   return(CL);
  }

The link that the site engine added would also be useful to study.

 
Tretyakov Rostyslav #:

a1)

а2)

б)

and on the other points?

 
Порт-моне тв #:

and on the other points?

We will deal with the issues as they arise...

First you need to make a table and define what should be there and where, and then write the functions

 
Mihail Matkovskij #:

The Color function should return colour, not double.

It wouldn't hurt to study the link that the site engine added too.

Thank you. let me read it

 
Tretyakov Rostyslav #:

We will deal with issues as they arise...

First you need to make a table and define what should be there and where, and then write the functions

I can basically do it, the hardest thing for me is to write the price to a file and calculate the time

Reason: