Statement clarification request!

 

This is a simple question. I am not well versed in MQ4 language.

How can I change a statement from:

if (OsMA Previous > OsMAPrevious 2) OsMADirection = 1

To: (OsMA Previous > OsMAPrevious 2) OsMADirection = Bullish ??

Is it as simple as putting quotations around Bullish. Your simple advice is appreciated.

Dave <<<
 
iscuba11:
This is a simple question. I am not well versed in MQ4 language.

How can I change a statement from:

if (OsMA Previous > OsMAPrevious 2) OsMADirection = 1

To: (OsMA Previous > OsMAPrevious 2) OsMADirection = Bullish ??

Is it as simple as putting quotations around Bullish. Your simple advice is appreciated.

Dave <<<

hi Dave if you are intending to use strings then OsmaDirection will also be a string .

string Bullish;

string Bearish;

string OsMADirection = "";

double OSMAPREVIOUS,OSMAPREVIOUS2;

-- your code.....

now you could say

if (OsMA Previous > OsMAPrevious 2) OsMADirection = Bullish;

else if(OSMA Previous < OsmaPrevious2) OsMADirection = Bearish;

Keep in mind OsMADirection is a string which means you can only use it with other string variables there are other ways to convert between variables but i think you are not asking for that.

regards

EACAN.

 

This may work for what I need. I will try to incorporate.

Thanks for responding!

Dave

<<
 
iscuba11:
This is a simple question. I am not well versed in MQ4 language.

How can I change a statement from:

if (OsMA Previous > OsMAPrevious 2) OsMADirection = 1

To: (OsMA Previous > OsMAPrevious 2) OsMADirection = Bullish ??

Is it as simple as putting quotations around Bullish. Your simple advice is appreciated.

Dave <<<

If u don't want to change the entire program u can do the following

at the start of the program put the line

#define Bullish 1

and everytime instead of using 1 as bullish u can just write Bullish instead

Eli

 

It worked!! Yaa Hoo! Have a blessed Sunday everybody!

Dave <<<