Ask! - page 80

 

simple coding question; I have:

Step0=iCustom(NULL,0,"StepChoppy_v1[1].3",0,lookupidx);

Step1=iCustom(NULL,0,"StepChoppy_v1[1].3",1,lookupidx);

Step2=iCustom(NULL,0,"StepChoppy_v1[1].3",2,lookupidx);

Step3=iCustom(NULL,0,"StepChoppy_v1[1].3",3,lookupidx);

if (Step0>=1 | Step1>=1 | Step2>=1 |Step3>=1)

maval=1;

else

maval= 0;

Problem is I get an error message when compiling: '|' - bitwise operators are to be applied to integer values only

if I use only

if (Step0>=1)

maval=1;

else

maval= 0;

It works, but I want with the other 3 variables as well!

Any hints?

 
camisa:
simple coding question; I have:

Step0=iCustom(NULL,0,"StepChoppy_v1[1].3",0,lookupidx);

Step1=iCustom(NULL,0,"StepChoppy_v1[1].3",1,lookupidx);

Step2=iCustom(NULL,0,"StepChoppy_v1[1].3",2,lookupidx);

Step3=iCustom(NULL,0,"StepChoppy_v1[1].3",3,lookupidx);

if (Step0>=1 | Step1>=1 | Step2>=1 |Step3>=1)

maval=1;

else

maval= 0;

Problem is I get an error message when compiling: '|' - bitwise operators are to be applied to integer values only

if I use only

if (Step0>=1)

maval=1;

else

maval= 0;

It works, but I want with the other 3 variables as well!

Any hints?

You have to use

if (Step0>=1 || Step1>=1 || Step2>=1 || Step3>=1)

The "OR" operator between two booleans is " || "

 
Files:
buy.bmp  954 kb
 
Michel:
You have to use
if (Step0>=1 || Step1>=1 || Step2>=1 || Step3>=1)
The "OR" operator between two booleans is " || "

damn, I knew it was something easy lol

thanks! it now works 5*****!

 

I wish you wrote me code from tutorial about EA (Your First Expert Advisor), which

will open many orders, but without dubling. I tried many things, but finally they didn't

work

For example. We are playing on 4 pairs: GBPUSD, GBPCHF, AUDUSD and EURUSD and we have

first three opened. If the function 'isCrossed' is equal 1 or 2, the EA will buy or sell EURUSD, becouse the others pairs are just open.

Sorry for my english :]

 

Curious question??

When do you use return(0); in "if" statements??

Dave

 

How do I do a time block on this deletion utility??

Figured it out!

 
if (UseHourTrade==true)

/////////////////////////////////////////////////////////

{

if(!(Hour()>=EndHour && Hour()>>> EndHour=17 / StartHour=0

{

Comment("PROGRAM SYSTEM IN HIBERNATION!");

}

}

I need clarification: Current time is 14 GMT, yet the ea is displaying the "PROGRAM SYSTEM IN HIBERNATION!" Why is it displaying??

Dave

 
1Dave7:
if (UseHourTrade==true)

/////////////////////////////////////////////////////////

{

if(!(Hour()>=EndHour && Hour()>>> EndHour=17 / StartHour=0

{

Comment("PROGRAM SYSTEM IN HIBERNATION!");

}

}

I need clarification: Current time is 14 GMT, yet the ea is displaying the "PROGRAM SYSTEM IN HIBERNATION!" Why is it displaying??

Dave

It's all about the (!). By putting the logic test into() with the ! before it, you are tell the comp that if the logic test is resulting in "false" then proceed into routine.

 

bool

Hello everyone,

always learning mql and the following code is very ambigous to me (stepMa Ea of Igorad)

// ------------

if ( FilterPeriod > 0 )

{

bool BuyFilter = false;

BuyFilter = ( Close[1]>iMA(NULL,0,FilterPeriod,0,MODE_EMA,0,1));

bool SellFilter = false;

SellFilter =( Close[1]<iMA(NULL,0,FilterPeriod,0,MODE_EMA,0,1));

}

else

{ BuyFilter = true; SellFilter = true; }

// ------------

I dont understand how we can declare and initialise a bool variable and assign to it an integer variable int the next line

//example

bool BuyFilter = false;

BuyFilter = ( Close[1]>iMA(NULL,0,FilterPeriod,0,MODE_EMA,0,1));

Could someone enlight please.

Thanks

Edit: ND, i'don't know if it is the good place to post this.

Reason: