[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1044

 
eddy:
I'm not interested. I just want to draw a line...
The points in the picture are max min ?
 
No, clozes
 
costy_:

Это для не стандартного подхода, того чего нет в отчете оптимизатора. файл здесь terminal\tester\files

Сохраняйте отчет из "Результаты оптим." сохран как>>


I now understand how to save something. Please tell me how to automatically save the results of the optimisation. Basically, I only care about the maximum drawdown and profit.
 
001:

Now I understand how to save something I need. Please advise how to automatically save the optimization results. In principle, I only care about maximum drawdown and profit.

In Deinit, count through OrdersHistoryTotal the sum of all profitable, unprofitable, drawdown, profit and to the file ;)

Something like this

   for(i=0;i<OrdersHistoryTotal();i++)
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) && OrderSymbol()==Symbol())
    if(OrderProfit()>=0)
     profit+=OrderProfit();
     else noprof+=OrderProfit();
   прибыль = profit  -  noprof;



 
eddy:
no, cloze.

About the same, on the lower period you can view the vector of the older one on the H1 chart in the ind H4 settings.

And what's it for?!

Files:
maxvekt.mq4  2 kb
 
costy_:

In Deinit, use OrdersHistoryTotal to countthe sum of all profitable, unprofitable, drawdown, profit and file it ; )

Something like this




Yes, there is that. Unfortunately this method gives different data from MT. You just need to atomically save the optimisation results to a file and that's it...
 
I don't understand the calculation. can you explain it to me using my drawing as an example?
 
costy_:

You scroll through the open and pending orders in order of position number in the list, select the one you are interested in and fetch its ticket

and continue working with the ticket.



If you do not know what to do with it, just do not know what to do with it.

Please tell me why do we need to do this if we have already selected the same order?

Or maybe I do not understand something: THIS code :

string symbol = Symbol();int cnt;
for(cnt = OrdersTotal(); cnt >= 0; cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy) {
ticketbuy=OrderTicket();OrderSelect(ticketbuy, SELECT_BY_TICKET, MODE_TRADES);lotsbuy2=OrderLots() ;
double bid = MarketInfo(symbol,MODE_BID);
RefreshRates();
OrderClose(ticketbuy,lotsbuy2,bid,3,Magenta); }

and this one:

string symbol = Symbol();int cnt;
for(cnt = OrdersTotal(); cnt >= 0; cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy) {
lotsbuy2=OrderLots() ;
double bid = MarketInfo(symbol,MODE_BID);
RefreshRates();
OrderClose(ticketbuy,lotsbuy2,bid,3,Magenta); }

will do the same thing?

 
Aleksandr_8:

Thank you for your reply.

Why do we need to do this if we have already selected the same order?

Or maybe I don't understand something: THIS code :

string symbol = Symbol();int cnt;
for(cnt = OrdersTotal()-1; cnt >= 0; cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy) {
ticketbuy=OrderTicket();OrderSelect(ticketbuy, SELECT_BY_TICKET, MODE_TRADES); lotsbuy2=OrderLots() ;
double bid = MarketInfo(symbol,MODE_BID);
RefreshRates();
OrderClose(ticketbuy,lotsbuy2,bid,3,Magenta); }
}

and this one:

string symbol = Symbol();int cnt;
for(cnt = OrdersTotal()-1; cnt >= 0; cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy) {
lotsbuy2=OrderLots() ;
double bid = MarketInfo(symbol,MODE_BID);
RefreshRates();
OrderClose(ticketbuy,lotsbuy2,bid,3,Magenta); }
}

will do the same thing?

The code marked in red is redundant, since the order has already been selected and you don't need to select it again to process it.

 
Aleksandr_8:

Thank you for your reply.

Why do we need to do this if we have already selected the same order?

Or maybe I don't understand something: THIS code :

string symbol = Symbol();int cnt;
for(cnt = OrdersTotal(); cnt >= 0; cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy) {
ticketbuy=OrderTicket();OrderSelect(ticketbuy, SELECT_BY_TICKET, MODE_TRADES);lotsbuy2=OrderLots() ;
double bid = MarketInfo(symbol,MODE_BID);
RefreshRates();
OrderClose(ticketbuy,lotsbuy2,bid,3,Magenta); }

and this one:

string symbol = Symbol();int cnt;
for(cnt = OrdersTotal(); cnt >= 0; cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy) {
lotsbuy2=OrderLots() ;
double bid = MarketInfo(symbol,MODE_BID);
RefreshRates();
OrderClose(ticketbuy,lotsbuy2,bid,3,Magenta); }

will do the same thing?

In the first variant, the second OrderSelect on ticketbuy, uses a second check, I guess (if it slips open on a pending or +1 ordertotal...).

In previous post correctly found errors (except green).

Ticket buy is not marked in the second one. We need to identify

string symbol = Symbol();int cnt;
for(cnt = OrdersTotal(); cnt >= 0; cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy) {
lotsbuy2=OrderLots() ;
double bid = MarketInfo(symbol,MODE_BID);
ticketbuy=OrderTicket();
RefreshRates();
OrderClose(ticketbuy,lotsbuy2,bid,3,Magenta); }
Reason: