fxDreema

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

    Variables + Constants inside Custom MQL code block?

    Questions & Answers
    2
    3
    240
    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.
    • I
      Ipod last edited by Ipod

      Im trying to use less blocks in my ea, and want to use Custom MQL blocks to reduce the block count, as below I am trying to turn this sequence which goes from left to right.

      95aa99d9-366e-4819-97ee-5d054a54c0cd-image.png

      I have tried this code snippet in a custom block but it does not seem to work, it compiles fine but does not function.

      int AMA_SellPrice = AMA_Price;
      
      if(AMA_Price == 3)
      {
          // If AMA_Price equals 3, increment AMA_SellPrice by 1
          AMA_SellPrice += 1; 
      }
      
      1 Reply Last reply Reply Quote 0
      • jstap
        jstap last edited by jstap

        Looks like you already have everything, just delete int as this is already defined in the variables tab. When you say doesn't seem to work, have you put the variable in a comment to see if it changes?

        Learn fxDreema Without the Wait!

        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

        Don’t miss out

        Click here➡️ https://mybook.to/fxDreema to get your copy today!

        Enjoy! 😊

        1 Reply Last reply Reply Quote 0
        • I
          Ipod last edited by

          Ahhhhhhh

          It does work! It turns out I had not spelled something correctly and it was trying to check a custom enum rather than the output of the enum. Now I can remove about 50 unrequired blocks in my ea, yikes.

          Thanks 🙂

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

          Online Users

          L

          18
          Online

          146.8k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors