Errors, bugs, questions - page 355

 
Is it always the same for agents as on the main computer?
 
dimonsky:
Do agents always have the same story as the master computer?
The idea is yes, but there are issues with history synchronisation and a few other things.
 

I haven't read the whole thread, so please excuse me if this has already happened.

1. will it be possible to choose a time (not to be confused with a date) to start and stop testing.

2. How in the tester to view trades on other pairs except set in settings (for multicurrency - for one instrument - "open chart" in test results, and for others).

 
Retsam:

I haven't read the whole thread, so please excuse me if this has already happened.

1. will it be possible to choose a time (not to be confused with a date) to start and stop testing.

2. How in the tester to view deals on other pairs except set in settings (for multicurrency - for one instrument - "open chart" in testing results, and for others).

1 There is no such feature - unless you ask to do it.

2 Also there is no such a thing,

 

Afternoon!

MT 5.425 Windows 7 x64

I start the indicator in a subwindow (subwindow 1), I put a chart there using a buffer. I want to get the minimum and maximum price of the window with ChartGetDouble(0,CHART_PRICE_MAX,1) and ChartGetDouble(0,CHART_PRICE_MIN,1), respectively.

The output is 0, the minimum and maximum of the main window is shown correctly (ChartGetDouble(0,CHART_PRICE_MAX) ChartGetDouble(0,CHART_PRICE_MIN)). ChartRedraw(0) does not work. If the chart starts scrolling with the mouse, the values will die - it starts displaying correctly.

This happens when I start it for the first time, or when I change values in the properties of the indicator.

Maybe it is an error, or maybe I am doing something wrong.

What is the meaning of this entry in the help file?

CHART_PRICE_MIN Minimum of chartdouble r/o modifier - number of subwindow

CHART_PRICE_MAX Maximum of the chartdouble r/o modifier - subwindow number

Thank you!

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков - Документация по MQL5
 
All chart windows are numbered from zero. 0 - main chart window, 1 - window of the first indicator, which is shown in a separate window. And so on.
 

I can't figure out what's wrong:

if the parameters of two indicators are the same, then the EA opens only a Buy, but if the parameters are different, then it is not clear how it closes the position......

In theory, it should close trades by the second indicator, but it is not so. The code itself:

#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\OrderInfo.mqh>
MqlRates mrate[];

input int TriX_PARAM=14;
input int TriX_PARAM_Close=50;

double TriX[];
double TriX_Close[];
int TriXHandle;
int TriXHandle_Close;

int OnInit()
  {

   TriXHandle=iTriX(Symbol(),PERIOD_CURRENT,TriX_PARAM,PRICE_WEIGHTED);
   TriXHandle_Close=iTriX(Symbol(),PERIOD_CURRENT,TriX_PARAM_Close,PRICE_WEIGHTED);
   return(0);
  }

void OnTick()
  {
   CTrade mytrade;
   CPositionInfo myposition;
   CSymbolInfo mysymbol;
   COrderInfo myorder;

   bool Sell_opened,Buy_opened;
   if(myposition.Select(_Symbol)==true) { if(myposition.Type()==POSITION_TYPE_BUY) Buy_opened=true;  if(myposition.Type()==POSITION_TYPE_SELL) Sell_opened=true;}

//Закрываем позицию
   if(Buy_opened==true || Sell_opened==true)
     {
      ArraySetAsSeries(TriX_Close,true);
      CopyBuffer(TriXHandle_Close,0,0,4,TriX_Close);

      if(Sell_opened=true && TriX_Close[1]>TriX_Close[2] && TriX_Close[2]<TriX_Close[3]) mytrade.PositionClose(_Symbol);
      if(Buy_opened=true && TriX_Close[1]<TriX_Close[2] && TriX_Close[2]>TriX_Close[3]) mytrade.PositionClose(_Symbol);

     }

//Открываем позицию
   if(Buy_opened==false && Sell_opened==false)
     {
      ArraySetAsSeries(TriX,true);
      CopyBuffer(TriXHandle,0,0,4,TriX);
      
      if(TriX[1]>TriX[2] && TriX[2]<TriX[3]) mytrade.Buy(0.1,_Symbol,NormalizeDouble(mysymbol.Ask(),_Digits),0,0);
      if(TriX[1]<TriX[2] && TriX[2]>TriX[3]) mytrade.Sell(0.1,_Symbol,NormalizeDouble(mysymbol.Bid(),_Digits),0,0);

     }
  }
 
Can I make it so that the terminal does not update during optimisation?
 
Jager:
Is it possible to prevent updating of the terminal during optimization?

So if the terminal is running and has not updated for 5-10 minutes,

It won't be updated and even if it is, the new settings won't be saved.

Before restarting the terminal, you can of course turn off the Internet

 
Mr.FreeMan:

I can't figure out what's wrong:

if two indicators have the same parameters, then the EA opens only Buy, and if the parameters are different, then it is not clear how it closes positions......

In theory, it should close trades by the second indicator, but it is not so. The code itself:

The code itself: In the beginning, you need to mark arrays differently.

that's better). change it:

CopyBuffer(TriXHandle_Close,0,0,3,TriX_Close);
CopyBuffer(TriXHandle,0,0,4,TriX);

on these lines

CopyBuffer(TriXHandle_Close,0,0,3,TriX_Close);
CopyBuffer(TriXHandle,0,0,3,TriX);

Also change

 if(Sell_opened=true && TriX_Close[1]>TriX_Close[2] && TriX_Close[2]<TriX_Close[3]) mytrade.PositionClose(_Symbol);
 if(Buy_opened=true && TriX_Close[1]<TriX_Close[2] && TriX_Close[2]>TriX_Close[3]) mytrade.PositionClose(_Symbol);
      if(TriX[1]>TriX[2] && TriX[2]<TriX[3]) mytrade.Buy(0.1,_Symbol,NormalizeDouble(mysymbol.Ask(),_Digits),0,0);
      if(TriX[1]<TriX[2] && TriX[2]>TriX[3]) mytrade.Sell(0.1,_Symbol,NormalizeDouble(mysymbol.Bid(),_Digits),0,0);

to this.

 if(Sell_opened=true && TriX_Close[0]>TriX_Close[1] && TriX_Close[1]<TriX_Close[2]) mytrade.PositionClose(_Symbol);
 if(Buy_opened=true && TriX_Close[0]<TriX_Close[1] && TriX_Close[1]>TriX_Close[2]) mytrade.PositionClose(_Symbol);
      if(TriX[0]>TriX[1] && TriX[1]<TriX[2]) mytrade.Buy(0.1,_Symbol,NormalizeDouble(mysymbol.Ask(),_Digits),0,0);
      if(TriX[0]<TriX[1] && TriX[1]>TriX[2]) mytrade.Sell(0.1,_Symbol,NormalizeDouble(mysymbol.Bid(),_Digits),0,0);
Reason: