round number

  • This topic has 10 replies, 4 voices, and was last updated 3 years ago by avatarPaul.
Viewing 11 posts - 1 through 11 (of 11 total)
  • #132962

    I there any code available to find the round number example for dax 11100 11200 etc

    similarly for dow 24400 , 24500

     

    code should give nearest round number the idea is to place 2 pips above round number 24400 buy and place stop loss 23990 etc

    #132968

    rama – You’ve been around long enough to know that your question is not a platform question but a strategy question. I’ve moved your topic to the correct forum. Please be more careful with future posts.

    #132969

    It took all of three seconds using the search box and typing in ’round numbers’ to find this:

    https://www.prorealcode.com/prorealtime-indicators/sweet-spots-numbers/

    You should try the search box some time as it is quite useful! 🙂

    #133131

    Before I asked the question i searched and tried, can I ask you try to see the level for 24600 at 100 intervals in the thread you suggested

    #133136

    I’m not sure exactly what you are asking for. With MainLevels = 100 and SubLevels = 100 it draws lines at 100 intervals. I did spot a couple of little errors in the code. The FOR NEXT loop should start from 1 and not from zero and the addition or subtraction of 0.51 should be 0.5.

    Here is a version of that code that simply returns the nearest round number above price and below price.

     

    #133143

    To always round a number (using ROUND) to the lowest positive integer -0.5 needs to be subtracted, while always rounding to the highest positive integer +0.4 needs to be added.

     

    #133147

    I’m not sure that is correct Roberto. I tested it with this little code:

    When using +0.4 sometimes it rounds it down rather than up.

    #133159

    because it rounds the first decimal position, to round the second one it should be 0.04 (or 0.05), 0.004 (or 0.005) for the third decimal position, etc…

     

    #133195

    Yes but in this indicator we always want to be a number above so if the current price is 1.0 then rounding with +0.4 will return 1.0 whereas we need it to be 2.0  To get 2.0 we have to add on 0.5

    In a normal rounding situation you are correct as 1.0 should return 1 when rounded but not if we want to always find the next whole number above the current value.

    #133198

    Got it.

    #133204
Viewing 11 posts - 1 through 11 (of 11 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login