Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1769

 

Good afternoon all. Please tell me if I need to start a test of the indicator in mt4 on d1 and when I get a signal from it I need to switch to n1. Can I do it without interrupting the test?

 
DanilaMactep #:

Good afternoon all. Please tell me if I need to start a test of the indicator in mt4 on d1 and when I get a signal from it I need to switch to n1. Can i do it without interrupting the test?

no

you need to start it on H1 and get the signal from D1

 
DanilaMactep #:

Good afternoon all. Please tell me if I need to start a test of the indicator in mt4 on d1 and when I get a signal from it I need to switch to n1. Can I do it without interrupting the test?

No. The timeframes cannot be switched in the tester. Therefore, you should either set the ticks model OHLC on M1 and watch the signals on H1 or D1, or select H1 and wait for the signal fromD1.

 
MakarFX #:

no

You have to run it on H1 and get the signal from D1

This is if the Expert Advisor is tested. I need to test it manually. That is, I should connect the Expert Advisor to the test and attach the indicator to the test chart. And I need to manually switch between timeframes during the test. Can this be done using a script or something else?

 
DanilaMactep #:

This is if the EA is being tested. But I need to test it manually. That is, I should connect the EA to the test and place the indicator on the test chart. And I have to manually switch between timeframes during the test. Can this be done using a script or something else?

Do you get the signal from the indicator?
 
MakarFX #:
Are you getting the signal from the indicator?
Yes from the indicator, but only in the form of beating its trend lines and then counter-trend lines on a lower timeframe - probably later I will record a video to make it clear;-)
 
DanilaMactep #:
Yes from the indicator, but only in the form of beating its trend lines and then on a lower timeframe counter-trend lines - probably later I will record a video to make it clear;-)

Make an MTF indicator and you'll be happy)

 
MakarFX #:

Do an MTF indicator and you'll be happy)

Can you please tell me what I have missed? This is a function in the EA.

Error: Exceeded array limits

int TradeSignal() 
  {
   int limit, i, sig=-1;
   double Ma_curr, Ma_prev, Buffer[];
   limit=MaPeriod*3;
   for(i=limit;i>=0;i--)
     {
      Ma_curr=iMA(_Symbol,_Period,MaPeriod,0,MaMethod,MaPrice,i);
      Ma_prev=iMA(_Symbol,_Period,MaPeriod,0,MaMethod,MaPrice,i+1);
      Buffer[i]=Ma_curr-Ma_prev;
      if(Buffer[i]>0) sig=0;
      if(Buffer[i]<0) sig=1;
     }
   return(sig);
  }
 
MakarFX #:

Can you please tell me what I am missing? This is a function in the EA.

Error: Array overrun

You have not allocated memory for the Buffer array

int TradeSignal() 
  {
   int limit, i, sig=-1;
   double Ma_curr, Ma_prev, Buffer[];
   limit=MaPeriod*3;
   ArrayResize(Buffer, limit);
   for(i=limit-1;i>=0;i--)
     {
      Ma_curr=iMA(_Symbol,_Period,MaPeriod,0,MaMethod,MaPrice,i);
      Ma_prev=iMA(_Symbol,_Period,MaPeriod,0,MaMethod,MaPrice,i+1);
      Buffer[i]=Ma_curr-Ma_prev;
      if(Buffer[i]>0) sig=0;
      if(Buffer[i]<0) sig=1;
     }
   return(sig);
  }
 
Mihail Matkovskij #:

You have no memory allocated for the Buffer array

Thank you very much.
Reason: