fxDreema

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

    Draw horizontal line and calculate round numbers from open price.

    Questions & Answers
    3
    3
    2298
    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.
    • O
      okranoblues last edited by

      I want to calculate the round price base on the open price from a buy or sell order. Can you please help?

      FXFun 1 Reply Last reply Reply Quote 0
      • FXFun
        FXFun @okranoblues last edited by

        @okranoblues
        Did you find a solution?

        I need a similar solution. I need to know the Upper & Lower Round number from current market price.

        From there it should be easy to get your next target TP & SL, by the round number, which I believe is what you want to have.

        Life is FUN - when you have control over it. Take control over FX & Have FUN all the Time! :-)

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

          I think we wrote emails back then with okranoblues.

          There is only a block that can detect round numbers, but it doesn't give you any values that can be used outside. I guess I need to add something in "Condition" block, but who knows when. Calculating round numbers may be actually easy, especially when the current price is used. In MT4 you can get the Ask/Bid price just by writing Ask or Bid, because they are predefined variables: https://docs.mql4.com/predefined

          Here is some calculation:

          MathCeil(Ask / gridsize) * gridsize
          

          Let's imagine that Ask is 0.942 and you want to get the upper round number that is rounded to the second digit. You want "gridsize" to be 0.01. Then you have:

          MathCeil(0.942 / 0.01) * 0.01
          

          And the result is 0.95.

          What is MathCeil()? You can see this function here: https://docs.mql4.com/math The function to be used for the lower side is MathFloor()

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

          Online Users

          S
          N
          S
          E
          H
          E
          S
          A
          T
          A
          A

          21
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors