fxDreema

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

    seeminly simple idea, kicking my @ss, please help

    Questions & Answers
    2
    2
    1020
    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
      ibetusuck last edited by

      hi attemping to make a ea based on round numbers, specificly every 100 pips..would like to place a pending order at x.xx90 for buy and x.xx10 sor sell...seemingy simple but...round number detector seems confused at times and is never exactly on round number , so cant find it that way, and pending oreder in grid , witch should work, cant seem to get a round number correct at start, in other words, if at x.xx33 when start ea , will grid will place trades acording to the 33 level, not the 00 level i desire.. have spent countless times tring diffent methods and cant find the simple answer i know is there, please help.. or is there a way to get pending order gind to start from a 00 mark?? thanks in advance

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

        Round numbers detector is some kind of filter, it should be placed somewhere under "on Tick" so it can check the current price at every tick and it would pass every time the price reaches a new round number. But this block is not really suitable for making pending orders.

        In the pending orders blocks there is nothing about round numbers, this is something that I should add, but who knows when. Anyway, I got something for you. These are some simple formulas for calculating round numbers out of the Bid price (in this example): https://fxdreema.com/shared/xHE9eHHHc

        MathCeil() and MathFloor() are MQL4 functions that give you the nearest bigger and the nearest smaller integer:
        https://www.mql5.com/en/docs/standardlibrary/mathematics/stat/mathsubfunctions/statmathceil
        https://www.mql5.com/en/docs/standardlibrary/mathematics/stat/mathsubfunctions/statmathfloor

        Bid is a predefined variable in MQL4 and it gives you the current Bid price of course. There is Ask as well.

        My example gives this result on the chart: http://prntscr.com/hafr46

        These values can be used as Open Price for a pending order and you can also customize the formula if you want.

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

        Online Users

        A
        V

        18
        Online

        146.7k
        Users

        22.4k
        Topics

        122.6k
        Posts

        Powered by NodeBB Forums | Contributors