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

 
Zhunko:

Vadim, can you code in Java?

 

Can someone post the simplest script to calculate the lot for a classic martingale: if the previous trade was closed with a loss, the next one opens with a double lot. I wrote it myself:

extern double Lot = 0.1; extern double MM_koef = 2; extern int magic = 56565;
double Lots=Lot;


{ OrderSelect(OrdersHistoryTotal(), SELECT_BY_POS, MODE_HISTORY); //verify the last order from the history
if( OrderMagicNumber() == magic
&& ( (OrderType() == OP_BUY && (OrderOpenPrice()-OrderClosePrice())<0) //for buy it means loss
|| (OrderType() == OP_SELL && (OrderOpenPrice()-OrderClosePrice())>0) //for sell it means loss
)
)
Lots=OrderLots()*MM_koef;Print(Lots);
}
if (Lots<=0) Lots=Lot;

....OrderSend(Symbol(), OP_BUY, Lots, .......

The autocalculation of lot on a Martin does not work, but is accepted equal to 0.1 for some reason? Can someone please tell me

 
AdvoTM: If the previous trade was closed with a loss - the next one is opened with double lot.

here is something similar for your purposes at hand:

double history(){
   int i;
//обьявляем необходимые нам переменные куда мы положим интересующие нас характеристики ордера   
   double profit;
   datetime time;
   time = 0;
   profit = 0;
   for(i = OrdersHistoryTotal();i>=0;i--){// Перебираем все закрытые ордера
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){//если ордер с таким номером (i) в списке закрытых ордеров есть ( не путать с тикетом)
            if(OrderSymbol() == Symbol()){//если выбранный ордер был открыт по нашей валютной паре
               if(time<OrderCloseTime()){//(сравниваем его с хранящимся в переменной time) 
                  time=OrderCloseTime();//если время закрытия ордера больше - ложим его в переменную
                  profit=OrderProfit();//и заодно запоминаем прибыль ордера
               }
            }
         }
   }
//по окончании этой процедуры в наших переменных будут сидет наибольшее время закрытия, и его профит. Или по нулям если история чистая.
//теперь мы можем выставлять условия в зависимости от результата процедуры
   
   if(profit == 0 &&time == 0){//действия если история чистая
      Print("история чистая");
   }
   if(profit >= 0){//действия если последний ордер был прибыльным, или нулевым
      Print("последний ордер был прибыльным, или нулевым");
   }
   if(profit <  0 ){//действия если последний ордер был убыточным
      Print("последний ордер был убыточным");
   }
return(profit);// вернем в качестве результата функции значение прибыли последнего ордера из истории, так на всякий случай ;)
}
 
Can you please tell me why it is not possible to log in here https://www.mql5.com/ru/auth_login? I can't enter my username and password (the cursor is not flashing or not present at all).
 
yosuf:
Can you please tell me why it's impossible to log in here https://www.mql5.com/ru/auth_login? I can't enter my username and password (the cursor doesn't blink or there is no cursor at all).

There's something wrong with you.

I tried it. Logged in without any problems.

 
Gentlemen, please explain about the drawdown... Well, maximum drawdown is clear, but relative drawdown is relative to what? and also Absolute drawdown... it is not even specified in %, what is it?
 
DhP:

There's something wrong with you.

I tried it. Got in without any problems.

What should I do, register again? Or where do I go for help?
 
yosuf:
What should I do, re-register? Or where do I go for help?
I would try restarting the computer first...)
 
DhP:
I would try restarting the computer first...)

Restarting didn't help
 

What is the reason why in the EA for OrderModify sometimes the modification is done automatically and sometimes the window is displayed and you have to press the button to confirm (the window that opens with F9 in MT).

There is just a line OrderModify(......) in the code and the above described logic is exactly not implemented.

I have a thought that if OrderModifu fails, the brokerage company will send a signal to open this window. Is it possible?

Reason: