fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Compile Error: Constant expected

    Questions & Answers
    3
    4
    3124
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      runekeeper last edited by runekeeper

      The problem seems to be because of the constants that I use. If I hardcode the values, there is no problem. However, if I use the "risk" "cutloss_pips" & "trailing_pips" constant, the project doesn't compile as ex4

      Please help me.
      [Click here to see my project]

      Here are my constants:!

      0_1497231543707_Capture.PNG

      EDIT:

      I got the "Cutloss_pips" and "Trailing_Pips" to work. Apparently, I should choose the "custom(pips)" mode "I MEAN" "this value, as is."
      0_1497272230888_stoploss.PNG

      The RISK is still a problem though.
      0_1497272306833_risk.PNG

      HOW DO I SOLVE THIS?

      U 1 Reply Last reply Reply Quote 0
      • U
        uchiha @runekeeper last edited by uchiha

        @runekeeper 0_1497648203282_Capture.JPG

        This means you should change your "float" to "double".

        R 1 Reply Last reply Reply Quote 0
        • R
          runekeeper @uchiha last edited by

          @uchiha i got it to work already actually. I didnt know how. I just redid everything editing the inputs that only matter. (I think if you can an input parameter, then switch it back to a different parameter, it messes with the codes.)

          1 Reply Last reply Reply Quote 0
          • fxDreema
            fxDreema last edited by

            I don't see that there is a problem with "float". I tested this, I put "float" constant in this "Risk percent" field and I got no error. But I got that "Constant expected" error immediately when I checked the checkbox. That checkbox is obviously not checked on the screenshot, but I assume that you have checked it in your actual project at some time and because of that you saw that error. And my explanation is this...

            Don't put a Constant in an input field and then check the checkbox. Because the constant is an input parameter for the EA, there is no need to also check it as such. When you do both things, the EA builder does not check for that and as a result you see an error when compiling. This is some kind of bug that I am actually aware of. But I always recommend to use the checkboxes only for quick tests when you are lazy to create a Constant, but to use Constants when you finally decide to have official input parameter.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post

            Online Users

            L
            S
            A
            F

            12
            Online

            146.7k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors