# Rounding daily close down to nearest 50 level

To add comments, please log in or register
59

Hi everyone,

I am seeking help to write the correct logic that can adjust the entry price for a trade, which is the nearest 25 level below each daily bar candle. For example, if the price of GBPUSD closed at 1.2966, then the entry price should be 1.2950. If the close was 1.2986, then the nearest 25 level would be 1.2975, and so forth.

Here is what I've come up with so far, but it does not seem to work. I'm not a coder but will appreciate any help I can get.

Thanks,

double   close = iClose(_Symbol, PERIOD_D1, 1);

double   pivotclose     = MathRoundDown (close , 25);

entryrprice = NormalizeDouble(pivotclose, _Digits);

59

Wrendon Timothy:

Hi everyone,

I am seeking help to write the correct logic that can adjust the entry price for a trade, which is the nearest 25 level below each daily bar candle. For example, if the price of GBPUSD closed at 1.2966, then the entry price should be 1.2950. If the close was 1.2986, then the nearest 25 level would be 1.2975, and so forth.

Here is what I've come up with so far, but it does not seem to work. I'm not a coder but will appreciate any help I can get.

Thanks,

double   close = iClose(_Symbol, PERIOD_D1, 1);

double   pivotclose     = MathRoundDown (close , 25);

entryrprice = NormalizeDouble(pivotclose, _Digits);

Sorry for the bother. Got it to work. Just needed to change 25 to 0.00250.

Kind regards,

To add comments, please log in or register