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

 
Alexey Viktorov:

Can I read the documentation?


Yeah. Thanks. Knew about that... forgot. I was at work - didn't have time to check it out.

 

Hello. I am learning to program in MQL4.

Can you tell me how to algorithmize a trend line on an oscillator, for example: CCI.

And when the oscillator breaks this trend line, the Expert Advisor should give a signal or open an order.

The code can be ready, but with comments. I want to understand and to understand how it all happens.

 
Good day all!
I am switching from mql4 to mql5 A QUESTION. Is it possible to transform a pending order to a market order in mql5? For example, a pending order can be converted to a market order only if the candlestick in which it is converted opened at 20 o'clock. And if this candlestick opened at a different time - instead of transforming a pending order into a market one, delete it at the moment of transformation, or later?
Thanks for the tip.
 
ANDREY:
Good day all!
I am switching from mql4 to mql5 A QUESTION. Is it possible to transform a pending order to a market order in mql5? For example, a pending order can be converted to a market order only if the open candle is at 20 o'clock. And if this candlestick opened at a different time - instead of transforming a pending order into a market order, delete it at the moment of transformation, or later?
Thanks for the tip.
To open a pending order at the moment of a candle with the lifetime equal to the timeframe of the timeframe. The expiry time should be more than 600 sec. For 5Minutes and Minutes we should delete the pending orders if they have not worked.
 

Please help, I can't create a condition


There are three buffers

ExtBuffer1 - indicator value
ExtBuffer2 - (red) after crossing the top level downwards to cross the bottom level upwards
ExtBuffer3 - (green) after crossing the bottom level downwards to cross the top level downwards

Help, please.

 
bool IsRed=false;

int OnCalculate(....)
   {
   if(ExtBuffer1[i-1]>UpLevel && ExtBuffer1[i]<=UpLevel) IsRed=true;
   if(ExtBuffer1[i-1]<DnLevel && ExtBuffer1[i]>=DnLevel) IsRed=false;

   if(IsRed)
      {
      ExtBuffer2=ExtBuffer1;
      ExtBuffer3=EMPTY_VALUE;
      }
   else
      {
      ExtBuffer3=ExtBuffer1;
      ExtBuffer2=EMPTY_VALUE;
      }
   return(0);
   }
 
Valeriy Yastremskiy:
To open a position at the moment of a candle with the lifetime equal to the timeframe. Expiry time should be more than 600 sec. For 5minutes and minutes remove the pending orders if they do not work.

Thanks for the tip.

 
Aleksei Stepanenko:

Thank you!!!

 
Hello, 2020.11.15_05:51 GMT+3. Something about my strategy tester in MT4 being too slow. It used to seem to run fine on my three months of history on the GBPUSD hourly chart not long. I was testing my Expert Advisor. And recently I tested my EA on GOLD,M15 for one month of history. It took me an hour and forty seven minutes to check it, but in the tester it was a day and a half. What can I do to make my strategy tester work fast? Should I write to Service Desk? Who knows what to do? I will wait for an answer. 06:04 GMT+3. Yes. I can attach the MT4 tester log.
Files:
20201113.log  45 kb
 
Can you please tell me how to calculate the cube root? expression MathPow(x,1/3)=1
Reason: