'&&' - condition cannot be a string

 

I need your help.

I wrote a code with many conditions, and some lines within the conditions list were:

........

Rank(7,PERIOD_M1,59) >=12 &&Rank(7,PERIOD_M1,29) >=12 && Rank(7,PERIOD_M1,14) >=12 && TradeType(CheckPairRank(1,PERIOD_M1,59)=="BUY") &&TradeType(CheckPairRank(1,PERIOD_M1,29)=="BUY") && TradeType(CheckPairRank(1,PERIOD_M1,14)=="BUY") &&

.......

and at the last line the compiler send the subject error.

What is it?

 
crossy:

I need your help.

I wrote a code with many conditions, and some lines within the conditions list were:

........

Rank(7,PERIOD_M1,59) >=12 &&Rank(7,PERIOD_M1,29) >=12 && Rank(7,PERIOD_M1,14) >=12 && TradeType(CheckPairRank(1,PERIOD_M1,59)=="BUY") &&TradeType(CheckPairRank(1,PERIOD_M1,29)=="BUY") && TradeType(CheckPairRank(1,PERIOD_M1,14)=="BUY") &&

.......

and at the last line the compiler send the subject error.

What is it?


Is there somebody who can help?
 
crossy:

I need your help.

I wrote a code with many conditions, and some lines within the conditions list were:

........

Rank(7,PERIOD_M1,59) >=12 &&Rank(7,PERIOD_M1,29) >=12 && Rank(7,PERIOD_M1,14) >=12 && TradeType(CheckPairRank(1,PERIOD_M1,59)=="BUY") &&TradeType(CheckPairRank(1,PERIOD_M1,29)=="BUY") && TradeType(CheckPairRank(1,PERIOD_M1,14)=="BUY") &&

.......

and at the last line the compiler send the subject error.

What is it?

Well it is not clear that is "Rank" and "TradeType" and also it all ends with && ... Are those functions or variables ?? Maybe those are not complete and working in themselves...

 
McKeen:

Well it is not clear that is "Rank" and "TradeType" and also it all ends with && ... Are those functions or variables ?? Maybe those are not complete and working in themselves...


Thankes Mckeen for your response.

RANK and TRASDETYPE are functions, and I will check...

 
crossy:

I need your help.

I wrote a code with many conditions, and some lines within the conditions list were:

........

Rank(7,PERIOD_M1,59) >=12 &&Rank(7,PERIOD_M1,29) >=12 && Rank(7,PERIOD_M1,14) >=12 && TradeType(CheckPairRank(1,PERIOD_M1,59)=="BUY") &&TradeType(CheckPairRank(1,PERIOD_M1,29)=="BUY") && TradeType(CheckPairRank(1,PERIOD_M1,14)=="BUY") &&

.......

and at the last line the compiler send the subject error.

What is it?


Are those conditions part of an if else ? If they are then you have to enclose each separate condition within parenthisis like this

(Rank(7,PERIOD_M1,59) >=12 ) && (Rank(7,PERIOD_M1,29) >=12)

That could be the cause of your error, without the parenthesis, && becomes part of the condition instead of separating them.

 

You can't (afaik) have the string "BUY" as a condition. You would need to define BUY and drop the inverted commas. You should check out what those functions are returning and it maybe change the return to a bool or int.

hth

V

Reason: