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

 
Is it possible to calculate minimum equity using historical order data?
 
forexnew:
Is it possible to calculate the minimum equity using historical data on orders?
.


Understand one thing - what is specified in "historical orderdata "??? You are interested in closing price, whether it is profit or loss for the selected order...? so what of it? The order history does not show the amount of the account drawdown in equity (the current loss) when the order has been in the market, i.e. the loss at its closing may amount to, say, 500 units of the currency but it would be shown in the order history while the equity could have decreased to -1000 units of the currency when the order was in the market. Please note: The Strategy Tester calculates losses on equity.

The answer to your question: you cannot.

 
LOA:

Good day!

Professionals help - I'm not going anywhere without you!

I have already addressed this issue, but have not found the error, I really wanted to understand it myself, I racked my brains for a few days, but so far not much experience.

The previous discussion ended with the idea that perhaps the reason is in the code of those indicators I am trying to use.

I have written an indicator (it is my first steps) that displays breakdown of ME_Proboy_F5

The problem is..... The indicator is not re-drawing when new bars are formed and it is reset to zero on the last bar after the receipt of a tick. It is re-drawn if you change the tf or display the properties.

The indicator requests data from other indicators, all except one ME_Proboy_F_5 (I place its code too) works fine. I cannot find any error in the second indicator as well. The indicator is redrawn, but it is slow, i.e. it is displayed correctly at the second restart (change the FF or display properties).

I would be very grateful for help.

Proboy_Order_F5 - this is the main indicator, about which I ask

ME_Proboy_F5 - the second one, which is doubtful


I'm sorry to keep pestering you with my question, but I really want to get to the bottom of it.

Applying the function limit=MathMin(Bars-1, Bars-counterd_bars-1) did not solve the problem, but I took the recommendations, worked on the programming style, I hope it worked, got rid of unnecessary variables.

See above for the essence of the problem

 
Roman.:


One thing you should understand - what is specified in "historical order data"??? Are you interested in closing price, profit or loss for the selected order...? So what of it? The order history does not show the amount of the account drawdown in equity (current loss) when the order has been in the market, i.e. the loss at its closing may amount to, say, 500 units of the currency but it would be shown in the order history while the equity could have decreased to -1000 units of the currency when the order was in the market. Please note: The strategy tester calculates the loss on equity.

The answer to your question: you cannot.

However, there is an indicator https://c.mql5.com/mql4/forum/2010/11/Equity_v7.zip where equity is somehow calculated based on historical data. I have not figured out yet how to do it. Perhaps, equity can be calculated based on key points (order closes) but how does it look like in the form of a single formula?

 

Here is the code with the condition that orders should be deleted after the expiry of time, this is the condition

MyCurrentTime >= OrderExpiriation && OrderMagicNumber() == MagicNumber

So, why if we insert this condition into the first if operator, then the other operator located inside it does not consider this condition?

That is, this code doesn't work and deletes all pending orders at once.

  for(int counter=0;counter<OrdersTotal();counter++)
    {
    if(OrderSelect(counter,SELECT_BY_POS,MODE_TRADES) == false) break;

    if(MyCurrentTime >= OrderExpiriation && OrderMagicNumber() == MagicNumber) //Если текущее время больше чем время истечения
      {
        
        
      if(OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLLIMIT || OrderType() == OP_BUYSTOP || OrderType() == OP_SELLSTOP)
        {
        OrderDelete(OrderTicket());
        }
        
      }
    }

And this code works and does not delete orders at once.

  for(int counter=0;counter<OrdersTotal();counter++)
    {
    if(OrderSelect(counter,SELECT_BY_POS,MODE_TRADES) == false) break;

    if(MyCurrentTime >= OrderExpiriation && OrderMagicNumber() == MagicNumber) //Если текущее время больше чем время истечения
      {
        
        
      if(OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLLIMIT || OrderType() == OP_BUYSTOP || OrderType() == OP_SELLSTOP && MyCurrentTime >= OrderExpiriation && OrderMagicNumber() == MagicNumber)
        {
        OrderDelete(OrderTicket());
        }
        
      }
    }
 
sss2019:

Here is the code with the condition that orders should be deleted after the expiry of time, this is the condition

So, why if we insert this condition into the first if operator, then the other operator located inside it does not consider this condition?

That is, this code doesn't work and deletes all pending orders at once.

And this code works and does not delete orders at once.

Both codes are not correct, so I analyze your code and I don't know what is correct/wrong.

Let's take the simplest example. You have 2 orders that need to be removed.

1) for(int counter=0;counter<OrdersTotal();counter++)

the beginning of a good 0 is less than two and the first order is safely removed, but then

2)

 for(int counter=0;counter<OrdersTotal();counter++)

counter = 1, but there is only one order left! It means that the condition (1<1) is not fulfilled, and the loop terminates...

 
ilunga:

Note that both codes are uncorrected, so I don't know what works right/wrong for you.

Let's take the simplest example. You have 2 orders, both need to be deleted.

1) for(int counter=0;counter<OrdersTotal();counter++)

The good 0 is less than two and the first order has been successfully deleted, but then

2)

counter = 1, but there is only one order left! It means that the condition (1<1) is not fulfilled and the loop terminates...


No, but that's the thing, at this point it deletes ALL the orders, cleanly. The problem is that it deletes them immediately.
 
LOA:

Good afternoon!

I have written an indicator (these are my first steps) that clearly shows the breakdown of ME_Proboy_F5


Good first steps, Olga Alexandrovna. 330 lines of code

 
forexnew:

However, there is an indicator https://c.mql5.com/mql4/forum/2010/11/Equity_v7.zip where equity is somehow calculated based on historical data. I have not understood the method yet. Perhaps, equity can be calculated based on the key moments (order closes) but what does it look like in the form of a formula?




Familiarise yourself with the concepts of EQUITY and BALANCE and what their differences are.

This indicator shows the equity line in real time, as the equity line is the current profit/loss on unclosed positions, "It is possible to really determine the equity by key points (order closures)" - not possible, so you will consider the change of the equity line on closed positions.

"The equity is somehow calculated on the basis of historical data" - no. This indicator calculates the equity line for the current moment - by open positions in the Market.

 

Good evening! I found this in S. Kovalev's tutorial. Kovalev, but in the MT4 terminal there's nothing but "woof! Please, advise, who knows where to borrow a set of sound signals for different operations, so that I don't have to keep looking at the computer all the time? Thanks for a possible hint!

   switch(Mess_Number)                 // Elegir texto del mensaje segun el numero 
     {
      case 1:
         Graf_Text="Closed order Buy "+ Number;
         PlaySound("Close_order.wav");                              break;
      case 2:
         Graf_Text="Closed order Sell "+ Number;
         PlaySound("Close_order.wav");                              break;
      case 3:
         Graf_Text="Deleted pending order "+ Number;
         PlaySound("Close_order.wav");                              break;
      case 4:
         Graf_Text="Opened order Buy "+ Number;
         PlaySound("Ok.wav");                                       break;
      case 5:
         Graf_Text="Opened order Sell "+ Number;
         PlaySound("Ok.wav");                                       break;
      case 6:
         Graf_Text="Placed pending order "+ Number;
         PlaySound("Ok.wav");                                       break;
      case 7:
         Graf_Text="Order "+Number+" modified into the market one";
         PlaySound("Transform.wav");                                break;
      case 8:
         Graf_Text="Reopened order "+ Number;
         PlaySound("Bulk.wav");                                     break;
      case 9:
         Graf_Text="Partly closed order "+ Number;
         PlaySound("Close_order.wav");                              break;
      case 10:
         Graf_Text="New minimum distance: "+ Number;
         PlaySound("Inform.wav");                                   break;
      case 11:
         Graf_Text=" Not enough money for "+
         DoubleToStr(Value,2) + " lots";
         Color_GT=Red;
         PlaySound("Oops.wav");                                     break;
      case 12:
         Graf_Text="Trying to close order "+ Number;
         PlaySound("expert.wav");                                   break;
      case 13:
         if (Number>0)
            Graf_Text="Trying to open order Sell..";
         else
            Graf_Text="Trying to open order Buy..";
         PlaySound("expert.wav");                                   break;
      case 14:
         Graf_Text="Invalid password. EA doesn't function.";
         Color_GT=Red;
         PlaySound("Oops.wav");                                     break;
      case 15:
         switch(Number)                 // Elegir texto del mensaje segun el numero del error 
           {
            case 2:   Graf_Text="Common error.";                    break;
            case 129: Graf_Text="Wrong price. ";                    break;
            case 135: Graf_Text="Price changed. ";                  break;
            case 136: Graf_Text="No prices. Awaiting a new tick.."; break;
            case 146: Graf_Text="Trading subsystem is busy";        break;
            case 5 :  Graf_Text="Old version of the terminal.";     break;
            case 64:  Graf_Text="Account is blocked.";              break;
            case 133: Graf_Text="Trading is prohibited";            break;
            default:  Graf_Text="Occurred error " + Number;//otros errores 
           }
         Color_GT=Red;
         PlaySound("Error.wav");                                    break;
      case 16:
         Graf_Text="Expert Advisor works only for EURUSD";
         Color_GT=Red;
         PlaySound("Oops.wav");                                     break;
      default:
         Graf_Text="default "+ Mess_Number;
         Color_GT=Red;
         PlaySound("Bzrrr.wav");                    
     }
Reason: