Jump to content
Medved Trader Forums
Jason

CS0019 Comparison Error

Recommended Posts

Why does this not work?

if ( (Low[2] < EMA_10) && Close[1] >= PP_S1 && Math.Abs(Close-Open) = Min(2,0, Math.Abs(Close-Open)) )

Incidentally, why can't I do something like this:

if ( (Close[2].Crosses(EMA_10)  && Close[1] >= PP_S1 && Math.Abs(Close-Open) = Min(2,0, Math.Abs(Close-Open)) )

Both fail for me. The idea is to test if the prior candle has a low below the EMA_10 and high above it.

Edited by Jason

Share this post


Link to post
Share on other sites

Sorry, forgot the actual error description:

Pos    Code    Description    
75, 10    CS0019    Operator '&&' cannot be applied to operands of type 'bool' and 'double'    

 

Share this post


Link to post
Share on other sites

I didn't have a chance to plug it in, but at first glance, = is an assignment, not a comparison. you want == there

if ( (Low[2] < EMA_10) && Close[1] >= PP_S1 && Math.Abs(Close-Open) == Min(2,0, Math.Abs(Close-Open)) )

if ( (Close[2].Crosses(EMA_10)  && Close[1] >= PP_S1 && Math.Abs(Close-Open) == Min(2,0, Math.Abs(Close-Open)) )

Share this post


Link to post
Share on other sites

Doh that did it. It was just flagging the error at the beginning at "(Low[2]" so I thought the problem was there.

 

Thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...