Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
In my strategy I need to round a number to multiple of an interval and have a choice of rounding up, down, and to the nearest mulitple of interval. I've found following code snippet that should do the job exactly as I need it:
Public enum required would be:
Now the problem is I can't get it to work. And when I use:
Expected behavior would be number 2 but...
I receive an error:
"The name 'Down' does not exist in the current context"
Am I missing something?
Can you help answer these questions from other members on NexusFi?
That was what I was missing.
Now it works for integers (RoundToInterval(3,2,IntervalRounding.Down) but stops when I use the example above (3.83, 2) - it says: Argument 1: cannot convert from double to decimal.
Do you know how to correct this or eventually know any other way of achieving what I need?