Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 229

 
Sepulca:


The brackets are missing....


brackets seem to be OK.

The full section looks like this:

void FindOrders()  
{
//--------------------------Стартовые данные---------------------------------------------
//Обьемы ордеров     //Количество ордеров   //Средение цены ордеров  //Прибыль ордеров
BuyLots =0;          BuyCount = 0;          BuyAP = 0;               BuyProfit = 0;
SellLots = 0;        SellCount = 0;         SellAP = 0;              SellProfit = 0; 
SellStopLots = 0;    SellStopCount = 0;     SellStopAP = 0;          SellStopProfit = 0; 
BuyStopLots = 0;     BuyStopCount = 0;      BuyStopAP = 0;           BuyStopProfit = 0; 
SellLimitLots = 0;   SellLimitCount = 0;    SellLimitAP = 0;         SellLimitProfit = 0; 
BuyLimitLots = 0;    BuyLimitCount = 0;     BuyLimitAP = 0;          BuyLimitProfit = 0; 
LotLastBuy = 0;      LotLastSell = 0;       BuyFirst =0;             SellFirst=0;
//--------------------------Окончание блока----------------------------------------------

//--------------------------Поиск ордеров------------------------------------------------
RefreshRates();
for(int cnt = 0; cnt < OrdersTotal(); cnt ++)                  //Для всехоткрытых ордеров
 {
  OrderSelect (cnt, SELECT_BY_POS, MODE_TRADES);      // Выбираем со всего масива ордеров
  if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)//Выбирам ордера експерта
   CommonProfit += OrderProfit()+OrderSwap();              // Подсчет совокупного профита
   if(OrderType()==OP_BUY)                                              
    {
     BuyTicket = OrderTicket();                                      // Сохранение тикета
     BuyLots += OrderLots();                                  // Общий обьем Всех позиций  
     BuyAP += OrderOpenPrice()*OrderLots();          // Средневзвешаная цена всех позиций  
     BuyLow = MathMin(BuyLow,OrderOpenPrice());                             // Нижний BUY     
     BuyFirst = MathMin(BuyFirst, OrderOpenTime());          // нахождение первой позиции 
     BuyLast = MathMax(BuyLast, OrderOpenTime());        // нахождение последнего позиции      
     BuyHigh = MathMax(BuyHigh, OrderOpenPrice());                         // Верхний BUY
     BuyProfit += OrderProfit()+OrderSwap();                           // Подсчет профита
     BuyCount++;                                                    // Количество ордеров
     LotLastBuy = MathMax(LotLastBuy, OrderLots());       // Поиск наибольшего объема BUY   
    }
   if (OrderType() == OP_SELL)
    {
     SellTicket = OrderTicket();                                     // Сохранение тикета
     SellLots += OrderLots();                                           // Подсчет объема
     SellAP += OrderLots()*OrderOpenPrice();                   // Вычисление средней цены
     SellFirst = MathMin(SellFirst, OrderOpenTime());        // нахождение первой позиции 
     SellLast = MathMax(SellLast, OrderOpenTime());         // нахождение позднего ордера
     SellHigh = MathMax(SellHigh, OrderOpenPrice());                      // Верхний SELL
     SellLow = MathMin(SellLow, OrderOpenPrice());                         // Нижний SELL
     SellProfit += OrderProfit()+OrderSwap();                          // Подсчет профита
     SellCount++;                                                   // Количество ордеров
     LotLastSell = MathMax(LotLastSell, OrderLots());    // Поиск наибольшего объема SELL   
    }           
   if (OrderType() == OP_SELLSTOP)
    {
     SellStopTicket  = OrderTicket();                                // Сохранение тикета
     SellStopLots += OrderLots();                                       // Подсчет объема
     SellStopAP += OrderLots()*OrderOpenPrice();               // Вычисление средней цены
     SellStopLast = MathMax(SellStopLast,OrderOpenTime());  // нахождение позднего ордера
     SellStopHigh = MathMax(SellStopHigh,OrderOpenPrice());               // Верхний SELL
     SellStopLow = MathMin(SellStopLow,OrderOpenPrice());                  // Нижний SELL
     SellStopProfit += OrderProfit()+OrderSwap();                      // Подсчет профита
     SellStopCount++;                                               // Количество ордеров
    }             
   if (OrderType() == OP_BUYSTOP)
    {
     BuyStopTicket = OrderTicket();                                  // Сохранение тикета
     BuyStopLots += OrderLots();                                        // Подсчет объема
     BuyStopAP += OrderLots()*OrderOpenPrice();                // Вычисление средней цены
     BuyStopLast = MathMax(BuyStopLast,OrderOpenTime());     //нахождение позднего ордера
     BuyStopHigh = MathMax(BuyStopHigh,OrderOpenPrice());                  // Верхний BUY
     BuyStopLow = MathMin(BuyStopLow, OrderOpenPrice());                    // Нижний BUY
     BuyStopProfit += OrderProfit()+OrderSwap();                       // Подсчет профита
     BuyStopCount++;                                                // Количество ордеров
    }             
   if (OrderType() == OP_SELLLIMIT)
    {
     SellLimitTicket = OrderTicket();                                // Сохранение тикета
     SellLimitLots += OrderLots();                                      // Подсчет объема
     SellLimitAP += OrderLots()*OrderOpenPrice();              // Вычисление средней цены
     SellLimitLast = MathMax(SellLimitLast,OrderOpenTime()); //нахождение позднего ордера
     SellLimitHigh = MathMax(SellLimitHigh,OrderOpenPrice());             // Верхний SELL
     SellLimitLow = MathMin(SellLimitLow, OrderOpenPrice());               // Нижний SELL
     SellLimitProfit += OrderProfit()+OrderSwap();                     // Подсчет профита
     SellLimitCount++;                                              // Количество ордеров
    }             
   if (OrderType() == OP_BUYLIMIT)
    {
     BuyLimitTicket = OrderTicket();                                 // Сохранение тикета
     BuyLimitLots += OrderLots();                                       // Подсчет объема
     BuyLimitAP += OrderLots()*OrderOpenPrice();               // Вычисление средней цены
     BuyLimitLast = MathMax(SellLimitLast,OrderOpenTime());  //нахождение позднего ордера
     BuyLimitHigh = MathMax(SellLimitHigh,OrderOpenPrice());               // Верхний BUY
     BuyLimitLow = MathMin(SellLimitLow, OrderOpenPrice());                 // Нижний BUY
     BuyLimitProfit += OrderProfit()+OrderSwap();                      // Подсчет профита
     BuyLimitCount++;                                               // Количество ордеров
    }
 }
//--------------------------Окончательное вычисление средних цен-------------------------

if (BuyLots != 0)       // Если есть ордера BUY, то вычисляется их средняя цена открытия
    BuyAP /= BuyLots;      

if (SellLots != 0)     // Если есть ордера SELL, то вычисляется их средняя цена открытия
    SellAP /= SellLots;      

 if (NormalizeDouble(MathAbs(BuyLots - SellLots), 3) != 0)// Если есть совокупная позиция
   {                                          // то вычисляется ее уровень безубыточности
    APrice = (BuyAP*BuyLots - SellLots*(SellAP - Spread))/(BuyLots - SellLots);  
    if (BuyLots > SellLots)                                   // Поправка для BUY - вверх
      APrice = MathCeil(APrice/Tick)*Tick;
     else                                                     // Поправка для SELL - вниз
      APrice = MathFloor(APrice/Tick)*Tick;
    if (BuyCount == 0)       // Если присутствуют только BUY, то совокупная цена равна их
      APrice = SellAP;                                                   //  средней цене
    if (SellCount == 0)     // Если присутствуют только SELL, то совокупная цена равна их
      APrice = BuyAP;                                                    //  средней цене
   }

}
//--------------------------Окончание блока----------------------------------------------
 
Limita:


Everything seems to be OK with brackets.

The full section looks like this:

if(OrderType()==OP_BUY) you have it working for orders on any character and for any magician! I told you there are not enough brackets!

  if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)//Выбирам ордера експерта ДЛЯ ДАННОГО IF
   CommonProfit += OrderProfit()+OrderSwap();              // Подсчет совокупного профита  СРАБАТЫВАЕТ ТОЛЬКО ЭТОТ ОПЕРАТОР
   if(OrderType()==OP_BUY)                                                              А ЭТО СРАБОТАЕТ БЕЗ УЧЁТА SYMBOL() И MAGIC



 

Thank you

Let's fix it

 
Good afternoon. Can you advise someone who understands statistics, I'm confused. I need to convert the current price series to a logarithmic scale. For this I need to do only this calculation and that's all ?
for(int i=0; i<Bars-1; i++)
      {
      NewPrice[i]=MathLog(Close[i]);
      }
The reason for the question is that I read everywhere - look at the Dow Jones chart for the entire history and see how the view on the logarithmic scale differs from the absolute one. And with me they are visually almost the same, i.e. there are differences of course, but not as much as in the examples.
 
Desead:
Good afternoon. Please advise who understands statistics because I am confused. I need to convert the current price series to logarithmic scale. I need to do this calculation only and all ? The reason for the question is that I read everywhere - look at the Dow Jones chart for the entire history and see how the view on the logarithmic scale differs from the absolute one. And with me they are visually almost the same, i.e. there are differences of course, but not as much as in the examples.


from the handbook - MathLog is the natural logarithm- but you seem to need the decimal one????

for(int i=0; i<Bars-1; i++)
      {
      NewPrice[i]=MathLog(Close[i])/MathLog(10);
      }
 
ALXIMIKS:


from the handbook - MathLog is the natural logarithm - but you need the decimal one????


Decimal doesn't help. It won't change the view.
 

Please help me to find either a code (I think I'm not the first to ask this problem), or an algorithm to calculate the following parameters:

The problem is the following: in Expert Advisor it is necessary to calculate the profit level (both open and pending orders, which will be opened later) at a certain price level (for example, at support, resistance levels), both at a certain symbol, and for all open positions (for cross rates, the profit is planned to be calculated at current prices).

I faced the following problems:

As it turned out, lot size is different for different brokerage companies (for example instaforex has 10 000 base currency units, not 100 000 as it is considered). Hence the question: how do I know the lot size in units of currency.

For this reason I cannot find any clear formula for calculating one pip value (and profit accordingly) and for converting profit from base currency (for cross-rates) to the currency of deposit.

I`d love to read an article about profit calculation and its forecasting (send me a link), because I feel I have a lack of knowledge on the subject (my head is a mess .... pip value... cross rates... where to multiply by the value of a pip and where to divide... brrrr... horrible)

 
it doesn't matter which one. The logarithm translates absolute values into relative values, and it doesn't matter what its basis is, as I understand it. The main thing is to understand how to do it correctly in order to see the percentage change of price in the indicator.
 

Today, when using the Fibonacci Fan, the terminal 4 closed itself.

No errors, no hang-up, just was the terminal - just disappeared the next second.

Question, how do I find out the cause of this miracle? Are critical errors logged somewhere???

 

Dudes! This is so fucked up! I woke up and I'm so dumb... I forgot and can't find it.

Function ObjectDescription() returns object description. And I need to set it. With what? What function? I understand - kindergarten, but what to do????

Reason: