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

 
The brackets have been looked at. It's clear. Thanks
 

Help, please. There is a simple indicator. It draws lines on High of candlesticks. How to make it draw a ray on High[2] and High[1], and then through 0 candle and the next (pink line). Thank you.

#property  copyright ""
#property  link      ""

#property  indicator_chart_window
#property  indicator_buffers 1
#property  indicator_color1  Yellow
#property  indicator_width1 2
#property  indicator_style1 0

double     Buffer1[];

int init()
  {
   SetIndexBuffer(0,Buffer1);
   SetIndexStyle(0,DRAW_LINE);
   return(0);
  }

int start()
  {
         Buffer1[0]=High[0];
         Buffer1[1]=High[1];
         Buffer1[2]=High[2];

         return(0);
  }
 
prom18:

Help, please. There is a simple indicator. It draws lines on High of candlesticks. How to make it draw a ray on High[2] and High[1], and then through 0 candle and the next (pink line). Thank you.

I need to know the coordinate of bar -1
Calculate the difference between the two highs - this will be the Y-shift for each successive candle.
X-shift is the period of the bar.

 

I still haven't received an answer to my question 7652 of 18.02.2019 about the settings in the tester.

It can't be that the connoisseurs, of whom there are so many on the Forum, don't know the answer!

Somebody answer that, otherwise how is it going to work?

 
realgentleman:

I still haven't received an answer to my question 7652 of 18.02.2019 about the settings in the tester.

It can't be that the connoisseurs, of whom there are so many on the Forum, don't know the answer!

Somebody answer that, otherwise how is it going to work from here?

What is the inference that it starts to work on ticks?

 
realgentleman:

I still haven't received an answer to my question 7652 of 18.02.2019 about the settings in the tester.

It can't be that the connoisseurs, of whom there are so many on the Forum, don't know the answer!

Somebody answer that, otherwise how is it going to work from here?

https://www.mql5.com/ru/forum/160683/page766#comment_10679075

Unfortunately I am a small and infrequent drinker, and you offered a drink for a favour ))))

difficult to say what you have with the tester, usually all problems with the tester is incorrectly downloaded the story

as an option, to solve your problem unambiguously, use in your code analysis of the bar opening, something like this:

// в самом верху кода и желательно в OnInit() дописать lasttime=0;  
datetime lasttime = 0;
//......
if(lasttime!=Time[1])
{
lasttime=Time[1];
вычисления по открытию бара....
}
Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
  • 2019.02.18
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
Taras Slobodyanik:

We need to find out the coordinate of bar -1
Calculate the difference between the two highs - this will be the Y-shift for each successive candle.
The X-shift is the period of the bar.

Thank you. I have understood and made it. Here is another question. If I make calculations on iHigh H4 and then switch to H1, the line is not displayed correctly. What could be the reason?
 
prom18:
Thank you. I've got it. I have another question. If I do calculations using iHigh H4 and then switch to H1, the line is displayed incorrectly. What may be the reason?

This is because High[] always contains data of the timeframe to which you switched, i.e. current timeframe. To avoid it, use iHigh() function instead of High[]. And you can also get the time you want to use from iTime().

 

What is the colour property of the border of a rectangle? Is there one?

 

Hello, can you please help me translate this into mql4?

H-hight L-low O-open C-close

A=O-C; B=H-L; S(a)=summmA[i-3:i-1]; S(b)=summB[i-3:i-1];

Q(a)=sqrt(summ(sqrA[i-3:i-1]); Q(b)=sqrt(summ(sqrB[i-3:i-1])

E=1/5*(summH[i-3:i-1]+summC[i-2;i-1])

D=1/5*(summ(L[i-3;i-1]+summC[i-2;i-1])

Reason: