Errors, bugs, questions - page 621

 
sergey1294:
First of all you divide integers so you get an integer, read about type conversion https://www.mql5.com/ru/docs/basis/types/casting
Yes indeed, but that wasn't the case before. I didn't even bother.
 
ivandurak:
Yes indeed, but before it was not. I didn't even bother.

Did it used to be in fours? because in fives it was from the beginning and will always be so (1/2=0; 1./2.=0.5).

If you want to specify duplicates explicitly add a point.

// Script program start function                                    
void OnStart()
  {
   int i;
   double   a,b ;
   for(i=0;i<10;i++)
      {
         a=1./2.;
         b=1./2.;
         Print("a=",a," ","b=",b) ;
      }   
  }
 
Urain:

Did it used to be in fours? Because it was in fives from the beginning.

If you want to explicitly specify duplicates, add a full stop.

This was never the case in either four or five.

Integer arithmetic (and even in the form of pure integer constants) is unambiguous.

 

I have encountered a discrepancy between the tester and the demo account:

After successful trading operation price fields are filled out differently in the response structure of the trade server. In the demo account everything is as it should be in the price field - the price at which the transaction was made, in the tester this field remains 0.

For testing, I have sketched an Expert Advisor that buys each tick and displays return code and price in the log:

//+------------------------------------------------------------------+
//|                                                  test-expert.mq5 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
         MqlTradeRequest trade_request;
         MqlTradeResult  trade_result;
         ZeroMemory(trade_request);
         ZeroMemory(trade_result);
         trade_request.action=TRADE_ACTION_DEAL; 
         trade_request.volume=0.1; 
         trade_request.type=ORDER_TYPE_BUY; 
         trade_request.price=SymbolInfoDouble(_Symbol,SYMBOL_ASK); 
         trade_request.symbol=_Symbol;
         OrderSend(trade_request,trade_result);
         Print(trade_result.retcode, "купили по цене ",trade_result.price);
  }
//+------------------------------------------------------------------+

When I run it on a demo account the log contains the following strings:

2012.01.16 12:48:29 test-expert (EURUSD,H1) 10009 bought at 1.266

And when running in the visualizer these :

2012.01.16 12:49:12 2011.12.30 00:00:11 10009 bought at a price of 0.0

Tell me is this a bug, a bug, or I do something wrong ?
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций - Документация по MQL5
 

Is there any way to control the prehistory in the tester.

A testing for 1 hour, from the period 1.01.2011 up to today loads only 6000 bars. In the settings is - max bars unlimited. history is all loaded from 1971 on the minute.

 

This question has arisen unexpectedly:

When loading an indicator through iCustom in an Expert Advisor, the indicator is loaded and works properly - the only thing is that its OnTimer function is not called.

Is it supposed to be like this, or is it a bug?

The same indicator just attached to a chart works fine.

Build 574.

 
Dima_S:

This question has arisen unexpectedly:

When loading an indicator through iCustom in an Expert Advisor, the indicator is loaded and works properly - the only thing is that its OnTimer function is not called.

Is it supposed to be like this or is it a bug?

It was designed that way.
 
antt:
That's the way it's meant to be.
Very original)
 
Dima_S:
Very original)

Timer events are generated for the graph and from there to the programmes that run on it (thrown on top of it). This is the ideology - Program Execution:

The client terminal sends the generated events to the appropriate open charts. Also events can be generated by charts (chart events) or mql5-programs (custom events). Generation of events of creating and deleting graphical objects on a chart can be enabled or disabled by setting the CHART_EVENT_OBJECT_CREATE and CHART_EVENT_OBJECT_DELETE properties of a chart. Every mql5-program and every chart has its own event queue, where all new events are stored.

The program receives events only from the chart on which it is running. All events are processed one after another in the order they are received.

Therefore, the indicator that is called from the Expert Advisor does not receive timer events. Try to apply the indicator to the chart using the ChartIndicatorAdd function from the Expert Advisor, will anything change?

 
Dima_S:
Very original)
The event was originally intended for experts and is essentially a chart event. The use of the event in indicators was added later and with the restriction that the indicator must be added to the chart.
Reason: