[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 561

 
Vinsant:

Help me understand the logic behind this indicator.

You can get banned for decompiling here.
 
Reshetov:
You can get banned for decompiling here.
Where can you see that it is a decomplit? ) Unfortunately I could not find the author and this indicator was showing good market entries in 2006, today I remembered it)) and I want to understand what its logic is based on.
 
sergeev:

Process via MinLot and LotStep

I need to do for example this - NormalizeDouble(lots,precision);

What would this do (MinLot and LotStep)?

 
Vinsant:
Where does it show that it's decomplete? )
A moderator will come along and figure out the logic of the code you posted. So you'd better hide it away before they show you where you can and can't see it.
 
Reshetov:
A moderator will come along and figure out the logic behind the code you posted. So you'd better hide it away, before you're pointedly shown where you can and can't see it.
Followed your advice.
 
fore-x:

I need to do for example this - NormalizeDouble(lots,precision);

What would this do (MinLot and LotStep)?

I just sketched it out. It goes something like this:
double minlot = MarketInfo(Symbol, MODE_MINLOT);

int d = 0;
 
if (minlot < 0.9999) {
  if (minlot < 0.09999) {
    d = 2;
  } else {
    d = 1;
  }
}

 ... 

NormalizeDouble(lots, d);
 
Reshetov:
I just sketched it out. It goes something like this:

Oh, I see, so it's a scientific exercise. The parameter is not stored anywhere, so we'll know.

 
fore-x:

Oh, I see, so it's a scientific exercise. The parameter is not stored anywhere, so we'll know.

It cannot be stored anywhere in the terminal, because the leverage may be floating and only the server knows about it. In my opinion, the most correct way to calculate it is as follows:

double minlot = MarketInfo(Symbol(), MODE_MINLOT);
double maxlot = MarketInfo(Symbol(), MODE_MAXLOT);
double lotstep = MarketInfo(Symbol(), MODE_LOTSTEP);

double SMALL = 0.0000001;

double lot, nextlot;

//обнуляем внутреннюю переменную ошибки
GetLastError();

//смотрим, насколько дают открыться
for(lot=0; lot<maxlot+SMALL && GetLastError()!=ERR_NOT_ENOUGH_MONEY; lot = nextlot)
{
   if(lot<minlot) nextlot = minlot;
   else nextlot = lot+lotstep;
   AccoutFreeMarginCheck(Symbol(), OP_BUY, nextlot);
}

// ответ на вопрос уже в переменной lot, а если вообще открыться нельзя, то там 0. Осталось нормализовать.
// Нормализацию правильно проводить от lotstep, а не от minlot, т.к. встречаются ситуации когда, например, 
// minlot = 3.0, а lotstep = 0.1

int dig = -MathFloor(MathLog(lotstep)/MathLog(10));

lot = NormalizeDouble(lot, dig);

 

Tell me why there may be an error 130

ticket1 = OrderSend(Symbol(),OP_BUYLIMIT,Lot,Level,Slippage,0,0,0,MagicNumber,0,Green);
 
sss2019:

Tell me why there may be an error 130


ticket1 = OrderSend(Symbol(),OP_BUYLIMIT,Lot,Level,Slippage,0,0,0,MagicNumber,0,Green);
                                                                ^
                                                          Что за хрень?