Find current and previous touch

MQL5 전문가 통합

명시

Hi everyone,

I need to store 2 data from a cross of 2 ema, each signal is generated by this and similar(there are 11 emas):  

TouchTime=TimeCurrent();

if(ema1[1] > ema2[1] && ema1[0]< ema2[0]) 
          {
           if(TouchTime != emacross1_TouchTime) 
           { 
           emacross1_TouchTime= TouchTime;
           }        
          }

if(ema2[1] > ema3[1] && ema2[0]< ema3[0]) 
          {...

and I would like to store the current and previous signal of this array:

int touchedline[10];
int temp = 0;
int valuearray = 0;

touchedline[0]=emacross1_TouchTime;
touchedline[1]=emacross2_TouchTime;
touchedline[2]=emacross3_TouchTime;
touchedline[3]=emacross4_TouchTime;
touchedline[4]=emacross5_TouchTime;
touchedline[5]=emacross6_TouchTime;
touchedline[6]=emacross7_TouchTime;
touchedline[7]=emacross8_TouchTime;
touchedline[8]=emacross9_TouchTime;
touchedline[9]=emacross10_TouchTime;

 I tried with this loop, but on tick mode when multiple signal are generated on the same bar it doesn't work correctly (as you can see from the picture attached):

 

int highest=-1, previoushighest=-1;

for(int i=0;i<10;i++)
     {
      if(touchedline[i]>temp)
        {
         highest=i;
         temp=touchedline[i];
        }
     }
   temp=0;
   for(int i=0;i<10;i++)
     {
      if(touchedline[i]>temp && i!=highest)
        {
         previoushighest=i;
         temp=touchedline[i];
        }
     }
   Print("act_highest :",highest);
   Print("prv_highest :",previoushighest);

파일:

PNG
mecca_ea.png
46.6 Kb
MQ5
mecca_ea.mq5
12.6 Kb

응답함

1
개발자 1
등급
(508)
프로젝트
764
63%
중재
33
27% / 45%
기한 초과
23
3%
무료
2
개발자 2
등급
프로젝트
0
0%
중재
2
0% / 100%
기한 초과
0
무료
3
개발자 3
등급
(13)
프로젝트
20
30%
중재
5
20% / 80%
기한 초과
5
25%
무료
4
개발자 4
등급
(8)
프로젝트
10
40%
중재
7
14% / 86%
기한 초과
4
40%
무료
5
개발자 5
등급
(20)
프로젝트
46
54%
중재
3
67% / 0%
기한 초과
14
30%
무료
비슷한 주문
I NEED TO HAVE MY INDICATOR CONVERTED TO PINESCRIPT. IF YOU CHARGE PER LINES PLEASE ADVISE ALSO I NEED THIS DONE QUICKLY. IF YOU ARE ABLE FINISH WITHIN A DAY OR 2 PLEASE APPLY. THE INDICATOR IS BASED OFF ZIG ZAG AND RSI
I'm looking for a website developer that can create a registration form with email and username. This information will be part of a license key on indicators and EAs sold on that website. However there will be a new job created for this stage. For now I just need a registration box with email and user name to be input by the user. A list or database of this information to be created. There should also be a help chat
Hi I want you to make software, let's give the software a name " rocky", I want to explain the project to understand the possibility, example: let's assume I have a computer and there is some internet browsers open, now the software "rocky" you will make is monitoring the computers full screen or a region of screen continuesly and as soon as the internet browser updates with some graphical changes (which is the text

프로젝트 정보

예산
10- USD
기한
에서 1  3 일