Position and Orders modify error

Created at 11 May 2020, 18:38
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
acnestis's avatar

acnestis

Joined 11.04.2019

Position and Orders modify error
11 May 2020, 18:38


Hello! I just want to modify my pending orders or opened positions. I need to modify TP (for opened positions) or target price + TP (for pending orders).

I'm using this code and getting errors like this "11/05/2020 18:23:05.828 | → Request to amend position PID107086204 is REJECTED with error "Nothing to amend."" , "11/05/2020 18:23:05.703 | → Request to amend order OID172282144 (TP: 6.29999999999686) is REJECTED with error "Nothing to amend.""

If I will modify following code from

double SellLim = barHigh - Dist * 1E-05;
double BuyLim = barLow + Dist * 1E-05;

to

double SellLim = barHigh;
double BuyLim = barLow;

All works fine without any errors. 

I just not understand this logic...

Please help me to understand what is going wrong...


@acnestis
Replies

PanagiotisCharalampous
12 May 2020, 08:23

Hi robustby,

This message usually appears when the modified parameter is the same as the previous one. To investigate your case further, you need to provide us with the complete cBot source code and cBot parameters to reproduce this message on backtesting.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

acnestis
12 May 2020, 11:21

RE:

PanagiotisCharalampous said:

Hi robustby,

This message usually appears when the modified parameter is the same as the previous one. To investigate your case further, you need to provide us with the complete cBot source code and cBot parameters to reproduce this message on backtesting.

Best Regards,

Panagiotis 

Join us on Telegram

Here is my code.

Problem with following code

            var SellLim = barHigh - Dist * 1E-05;
            var BuyLim = barLow + Dist * 1E-05;

If I put it instead of 

            var SellLim = barHigh;
            var BuyLim = barLow;

With the code above all working fine.

You can use any of parameters, it's doesn't matter. For example: bar_analyse=20, Dist=5, IndBar=8.


@acnestis

PanagiotisCharalampous
12 May 2020, 14:55

Hi robustby,

Try rounding the values before using them

            var SellLim = Math.Round(barHigh - Dist * 1E-05, Symbol.Digits);
            var BuyLim = Math.Round(barLow + Dist * 1E-05, Symbol.Digits);

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

acnestis
12 May 2020, 15:19

RE:

PanagiotisCharalampous said:

Hi robustby,

Try rounding the values before using them

            var SellLim = Math.Round(barHigh - Dist * 1E-05, Symbol.Digits);
            var BuyLim = Math.Round(barLow + Dist * 1E-05, Symbol.Digits);

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you so much! It's works :)


@acnestis