Errors, bugs, questions - page 855

 
gdtt:

This construct:

I think it should be forbidden, as it is a direct reference to a private member of another object, albeit of the same data type.

Do you think it should be prohibited? Don't use it.

Any class members declared after the private: element access specifier (and before the next access specifier) are available only to member functions of this class.

The documentation explicitly says about access and nothing about objects (only about classes).

By the way, copy constructors are based on exactly this effect.

 
stringo:

Do you think it should be forbidden? Don't use it.

The documentation explicitly says about access and nothing about objects (only about classes).

By the way, copy constructors are based on exactly this effect.

ok, got it, thanks
 
Alex5757000 It turns out that the previously called OrderCalcMargin() function for a pending order has returned 0.0?

Well yes, judging from the description of the situation,OrderCalcMargin() function for pending orders returns "0.0". This indicates that no margin is required for pending orders.

If you need to estimate how much margin will be needed when the pending order triggers, then use one of the market orders as the first parameter.

 

So, "EX5 loading failed" error after I put the functions in the library.

#import "GetPriceBy.ex5"
double GetHighByTime(datetime Time);
double GetLowByTime(datetime Time);
#import

What's wrong?

------------------------------

Decided to check if the problem is in the functions themselves. Even if the bodies of all the library functions consist only of "return(1);" there is still an error

import as in the help example

#import "user32.dll"
int    MessageBoxW(uint hWnd,string lpText,string lpCaption,uint uType);
#import "stdlib.ex5"
string ErrorDescription(int error_code);
int    RGB(int red_value,int green_value,int blue_value);
bool   CompareDoubles(double number1,double number2);
string DoubleToStrMorePrecision(double number,int precision);
string IntegerToHexString(int integer_number);
#import "ExpertSample.dll"
int    GetIntValue(int);
double GetDoubleValue(double);
string GetStringValue(string);
double GetArrayItemValue(double &arr[],int,int);
bool   SetArrayItemValue(double &arr[],int,int,double);
double GetRatesItemValue(double &rates[][6],int,int,int);
#import
 
FiftyStars:

So, "EX5 loading failed" error after I put the functions in the library

Are the functions declared as exportable in the library?
 
alexvd:
Are the functions declared as exportable in the library?
declared, but I have already solved the problem - I just rebooted the computer xD I guess a month of uninterrupted work has made itself felt...and the problems have already started to appear in many places
 
Tell me, here is my request structure, what else does it basically lack?
  
 
 MqlTick last_tick;SymbolInfoTick(Symbol(),last_tick);
 
   MqlTradeRequest request={0};
      MqlTradeResult result={0};
      
 
  {
    request.     action=TRADE_ACTION_DEAL;           // Тип выполняемого действия
    request.     price=last_tick.bid;
    request.                        volume=1;           // Запрашиваемый объем сделки в лотах     
    request.     type=ORDER_TYPE_SELL;     // Тип ордера
    request.     type_filling =ORDER_FILLING_RETURN;          
    
   }
   
  OrderSend(request,result); 
  
  
  int Error=GetLastError(); ResetLastError();
        printf("Error %i ",Error);
      
        

2012.10.10 19:22:29 (EURUSD,M1) Error 4756 ERR_TRADE_SEND_FAILED
4756
Could not send trade request

I'm sorry, why can't I do without as much information as possible, for example, if I open a position, not an order, then I don't have to specify the price? If there are no stop-profits, then why not? Maybe, I want to set them later by a robot. What field is so critically lacking in the trade request? Or what is it?

Is it also possible not to specify it? type_filling. It says something about order not being able to be filled by the whole amount... How so? I don't really get it. Okay.

Ah, I guess it was critical there request.symbol=_Symbol; I thought that the delivery of the position exactly on the chart where the robot will generally go without saying...

 
Can you tell me how to set LR Correlation as an optimisation result parameter (Custom max)?
 
Vacuum:
Can you tell me how to set LR Correlation as a parameter of optimization result (Custom max)?

First of all LR Correlation needs to be calculated. This is done in this library https://www.mql5.com/ru/code/1081

And then return this value via OnTester, like here https://www.mql5.com/ru/articles/286

CTradeStatistics
CTradeStatistics
  • votes: 8
  • 2012.09.13
  • Andrey Voytenko
  • www.mql5.com
Класс для расчета показателей из перечисления ENUM_STATISTICS
 
Dimka-novitsek:
Tell me, here is my request structure, what else does it basically lack?

2012.10.10 19:22:29 (EURUSD,M1) Error 4756 ERR_TRADE_SEND_FAILED
4756
Could not send trade request

I'm sorry, why can't I do without as much information as possible, for example, if I open a position, not an order, then I don't have to specify the price? If there are no stop-profits, then why not? Maybe, I want to set them later by a robot. What field is so critically lacking in the trade request? Or what is it?

Is it also possible not to specify it? type_filling. It explains something, like the order may not be executed by its entire volume... How so? I don't really get it. Okay, .

Ah, I guess it was critical there request.symbol=_Symbol; I thought that the delivery of the position on the chart where the robot would be in general...

I suggest using the standard library:

#include <Trade\Trade.mqh>
CTrade            trade;
MqlTick           last_tick;
double Lot=0.01;
string main_comment="";
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//--- тип позиции
   bool Type;
//----------------------------------+
//--- если покупаем
   Type=true;                         
//--- если продаём     
   Type=false;
//----------------------------------+
   if(Type)
     {
      SymbolInfoTick(_Symbol,last_tick);
      double price=last_tick.ask;
      trade.PositionOpen(_Symbol,ORDER_TYPE_BUY,NormalizeDouble(Lot,2),price,0,0,main_comment);
     }
   else
     {
      SymbolInfoTick(_Symbol,last_tick);
      double price=last_tick.bid;
      trade.PositionOpen(_Symbol,ORDER_TYPE_SELL,NormalizeDouble(Lot,2),price,0,0,main_comment);
     }

  }