Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

more decimals in double

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    more decimals in double

    Hi there,

    Can I change the number of decimals used in a double ?

    I am setting a condition where I want to check that 'MACD diff' is either ebove 0.000001 or below -0.000001. The Condition builder only allows for 3 decimals. How can I do this ?

    And, when I need to unlock the code for this, I suppose there is now way to 'lock' it again afterwards to continue to use the builder ?


    Thanks in advance for your help

    #2
    I haven't looked, Are you sure the MACD diff even is near that precision?

    Comment


      #3
      Yes I am sure. MACD diff values range between 0.005 and -0.005 most of the time. Only during extreme raises or drops it goes beyond those limits.

      So, again: how would i test against a value of 0.0001 or even 0.00001 ?

      Thanks for showing interest

      Comment


        #4
        Create a derived variable that is 1000*MACDdiff and compare that?

        Comment


          #5
          Yes, that might mork imo.

          I have zero experience in creating derived variables.

          I fiddled with the code a bit and I now have values well above 0 for MACDDiff

          However, I can't seem to figure out where to put the "*100000" to also have the lines plot to this new scale.
          Code:
          fastEma.Set((2.0 / (1 + Fast)) * Input[0] + (1 - (2.0 / (1 + Fast))) * fastEma[1]);
                          slowEma.Set((2.0 / (1 + Slow)) * Input[0] + (1 - (2.0 / (1 + Slow))) * slowEma[1]);
          
                          double macd        = (fastEma[0] - slowEma[0])[COLOR=Red](tried here but didn't work)[/COLOR];
                          double macdAvg    = ((2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1]);
                          
                          Value.Set(macd[COLOR=Red](tried here, didn't work)[/COLOR]);
                          Avg.Set(macdAvg);
                          Diff.Set((macd - macdAvg)*100000[COLOR=Lime](seems to be the right spot for the *100000)[/COLOR]);
                      }
                  }
          Thanks, esteemed panel
          Last edited by Spinn; 06-06-2015, 07:12 AM. Reason: typo

          Comment


            #6
            Now that's a lot different than the original question.

            I don't think .set dataseries goes to that precision.

            Comment


              #7
              Originally posted by Spinn View Post
              Hi there,

              Can I change the number of decimals used in a double ?

              I am setting a condition where I want to check that 'MACD diff' is either ebove 0.000001 or below -0.000001. The Condition builder only allows for 3 decimals. How can I do this ?

              And, when I need to unlock the code for this, I suppose there is now way to 'lock' it again afterwards to continue to use the builder ?


              Thanks in advance for your help
              If you want to do anything that the wizard is incapable of generating, you have to unlock the code and make the adjustments to whatever precision that you desire.

              Comment


                #8
                Hello Spinn,

                Thank you for your post.

                You would not be able to do this in the Strategy Wizard, and unfortunately unlocking the code means you cannot re-lock it later.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                571 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                330 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                548 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                549 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X