Normalize double price and broker restrictions (solved)

 

Dear friends,

I am having quite a hard time normalizing double prices for certain instruments, for examples, cfd's, because the broker only allows certain values.

For example, some indices allow only SL, TP and TS values which floating value are multiples of 5. Ie: 5000.05, 5000.10, 5000.15, 5000.20, etc.

This is quite a problem because some orders are rejected, and this limitation changes from instrument to instrument.

How do you get over this problem?

Thanks!

 

you know how to program so

if you have this problem with lotstep how do you handle it in that case ??

 
flaab:

Dear friends,

I am having quite a hard time normalizing double prices for certain instruments, for examples, cfd's, because the broker only allows certain values.

For example, some indices allow only SL, TP and TS values which floating value are multiples of 5. Ie: 5000.05, 5000.10, 5000.15, 5000.20, etc.

This is quite a problem because my some orders are rejected, and this limitation changes from instrument to instrument.

How do you get over this problem?

Thanks!

Your prices must be a multiple of the instrument's ticksize. See, for example, WHRoeder's NormalizePrice() function.
 
Thirteen:
Your prices must be a multiple of the instrument's ticksize. See, for example, WHRoeder's NormalizePrice() function.
Thanks!
 
deVries:

you know how to program so

if you have this problem with lotstep how do you handle it in that case ??

Thanks too!