Download MetaTrader 5
To add comments, please log in or register
Develop applications to order. Make profit using Freelance service!
m_shafiei2006
147
m_shafiei2006 2016.07.16 01:24 

Hi


I need to check the combination of my boolean functions which actually are situations that may happen in chart and are in extern. let you explain it by an example.

I have 10 different functions that their names are OPT1, OPT2,.... OPT10.

to check them I have to make groups of them, So I have to check them in different levels. in first level, for the example, we have maximum of 5 group.

the number of groups in each level is  MathCeil((last group number after first level or number of functions for first level)/2)

in each group I need to check three situations: 1. "All of the values in the group are true" 2."One of the Values in the group is true" 3. "None of the values in the group are true."

I write a while in while in while code but it was a mess.

is it possible to code a universal function for this  application if I have more functions but knows the number of functions ?

If anybody knows how to code this, please help me.


thanks

Keith Watford
Moderator
7887
Keith Watford 2016.07.16 08:24  

m_shafiei2006:


in each group I need to check three situations: 1. "All of the values in the group are true" 2."One of the Values in the group is true" 3. "None of the values in the group are true."




set a variable to zero

check each condition and increase the variable if the condition is true

check whether the variable == 5,1 or 0

m_shafiei2006
147
m_shafiei2006 2016.07.18 15:52  
GumRai:

set a variable to zero

check each condition and increase the variable if the condition is true

check whether the variable == 5,1 or 0

Thank you for your reply,

I think I couldn't tell you my meaning. this is not my problem, the problem is how to count a series of variable that contain continuous numbers.

for example I have 5 situations;

bool Sit1 ();
bool Sit2 ();
bool Sit3 ();
bool Sit4 ();
bool Sit5 ();


I get the group number of levels of each situation from input and type of each group from extern input,


// group numbers of level 1 from input (up to 3 groups)


extern int

GSit1L1 = 1,
GSit2L1 = 3,
GSit3L1 = 2,
GSit4L1 = 3,
GSit5L1 = 2
;

// group numbers of level 2 from input (up to 2 groups)

extern int

GSit1L2 = 4,
GSit2L2 = 5,
GSit3L2 = 4,
GSit4L2 = 5,
GSit5L2 = 4
;

//group types from input (-1,0,1,2)

extern int

GT1 = -1,
GT2 = 2,
GT3 = 2,
GT4 = 1,
GT5 = 1

;

So if I could count the members of each group and the number of situations that belong to a group, then I can compare and find the result.

I asked a C programmer who doesn't listen carefully and he said it is impossible, another one said you can count a series of variable that contain continuous numbers with arrays, but I don't know how;

or do you have another way to handle it ?

please help.

thanks

m_shafiei2006
147
m_shafiei2006 2016.07.19 18:58  
someone, please.
Keith Watford
Moderator
7887
Keith Watford 2016.07.19 19:03  
I am unable to understand what you are trying to do so am unable to offer any advice.
m_shafiei2006
147
m_shafiei2006 2016.07.19 20:40  

ok,


just tell me how to count a series of variable that contain continuous numbers in a "for" loop .

extern int

GSit1L1 = 1,
GSit2L1 = 3,
GSit3L1 = 2,
GSit4L1 = 3,
GSit5L1 = 2
;

extern int

GT1 = -1,
GT2 = 2,
GT3 = 2,
GT4 = 1,
GT5 = 1

;

int 
GML1GT1,
GML1GT2,
GML1GT3,
GML1GT4,
GML1GT5;

int GML1 ()
{
   for (int i=GSit1L1; ; ++)
   if (i==GT1)
   GML1GT1++
   if (i==GT2)
   GML1GT2++   
   if (i==GT3)
   GML1GT3++   
   if (i==GT4)
   GML1GT4++   
   if (i==GT5)
   GML1GT5++   
   if (i==GT6)
}
the loop is from GSit1L1 to GSit5L1.
/
To add comments, please log in or register