Error in Trailing SL updation

Created at 14 May 2014, 07:09
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!
WI

WinningTrader

Joined 12.05.2014

Error in Trailing SL updation
14 May 2014, 07:09


14/05/2014 03:57:50.218 | → Modifying position PID182023 (SL: 1.37163, TP: 1.37187) FAILED with error "TechnicalError", Position PID182023

14/05/2014 04:00:50.924 | → Modifying position PID182024 (SL: 1.37143, TP: 1.37185) FAILED with error "TechnicalError", Position PID182024

 

Dear Admin,

Getting the above Error Message - It says StopLoss cannot be Same as Takeptofit ?

Pls look into

 

WT

 


@WinningTrader
Replies

Spotware
14 May 2014, 09:10

Please press Ctrl+Alt+Shift+T. It will send us troubleshooting information.


@Spotware

Yasen
14 May 2014, 12:51

Same situation after an update - changing      ModifyPosition(position, SL, TP); to  ModifyPositionAsync(position, SL, TP); worked like charm...
                              


@Yasen

Spotware
14 May 2014, 14:27

Error "The STOP LOSS and TAKE PROFIT of your position cannot have the same value" occurs if you are trying to update protection of your position to the same values.

For example if your position has SL: 1.37084 and TP: 1.37090 and you are trying to update protection to SL: 1.37084 and TP: 1.37090 you will see such error.

You can avoid such error if you will check current values of SL and TP before modification:

            if (position.StopLoss != newStopLoss || position.TakeProfit != newTakeProfit)
                ModifyPosition(position, newStopLoss, newTakeProfit);

 


@Spotware

WinningTrader
15 May 2014, 15:30

RE:

Spotware said:

Error "The STOP LOSS and TAKE PROFIT of your position cannot have the same value" occurs if you are trying to update protection of your position to the same values.

For example if your position has SL: 1.37084 and TP: 1.37090 and you are trying to update protection to SL: 1.37084 and TP: 1.37090 you will see such error.

You can avoid such error if you will check current values of SL and TP before modification:

            if (position.StopLoss != newStopLoss || position.TakeProfit != newTakeProfit)
                ModifyPosition(position, newStopLoss, newTakeProfit);

 

2014.05.15 12:05:09.183 | → Order OID3221721 is FILLED at 1.36639, position PID2129300 (15/05/2014 12:05:08.963 UTC+0)
2014.05.15 12:05:09.542 | Request to amend position PID2129300 (SL: 101.70700) is sent to server
2014.05.15 12:05:09.963 | → Request to amend position PID2129300 (SL: 101.70700) is REJECTED with error "TRADING_BAD_STOPS"
2014.05.15 12:05:09.979 | Request to close position PID2129300 is sent to server
2014.05.15 12:05:10.650 | → Request to close position PID2129300 is ACCEPTED, order OID3221723 created (15/05/2014 

Dear Admin - 

Again the Error Struck - even after implementing your logic ...

sent Information  Ctrl+Alt+Shift+T. - hope it

 

This time I have sent 


@WinningTrader

WinningTrader
15 May 2014, 17:26

Dear Admin,

system used OMF Ctrader - OMF calgo

system buying higher than set quantity ( volume)

system alternating between successfully modifying Stop loss and throwing out errors

The Max Number of Trades has been set - but it easily surpasses every single time -

I am just thankful it is a demo Account - Pheeeewwwwwww..

Pls have a look


@WinningTrader

Spotware
15 May 2014, 17:52

Error "TRADING_BAD_STOPS" happens if you send SL or TP which are not valid in relation to spot prices.


@Spotware

gautam
15 May 2014, 18:50

RE:

Spotware said:

Error "TRADING_BAD_STOPS" happens if you send SL or TP which are not valid in relation to spot prices.

Admin

 

This happens alternatively - 

same log has alternative successful SL up dation and errors


@gautam

WinningTrader
15 May 2014, 18:56 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

gautam said:

Spotware said:

Error "TRADING_BAD_STOPS" happens if you send SL or TP which are not valid in relation to spot prices.

Admin

 

This happens alternatively - 

same log has alternative successful SL up dation and errors

 


@WinningTrader

WinningTrader
15 May 2014, 18:59

As you can see from screen shots - 

Only trade is open - Note the sucess message and error messages in split second time difference

 

The Code is correct - 

 

  if (newStopLossPriceSell < position.StopLoss || newStopLossPriceSell != position.TakeProfit || newStopLossPriceSell < position.TakeProfit)
                    {
                        ModifyPosition(position, newStopLossPriceSell, position.TakeProfit);

 

and vice versa for buy trades . .

 

 


@WinningTrader

WinningTrader
15 May 2014, 19:12

RE:

WinningTrader said:

 

if (newStopLossPriceSell < position.StopLoss & newStopLossPriceSell != position.TakeProfit & newStopLossPriceSell < position.TakeProfit)
                    {
                        ModifyPosition(position, newStopLossPriceSell, position.TakeProfit);

 

Previous Code was errorenous -

corrected

As you can see from screen shots - 

Only trade is open - Note the sucess message and error messages in split second time difference

 

The Code is correct - 

 

  if (newStopLossPriceSell < position.StopLoss || newStopLossPriceSell != position.TakeProfit || newStopLossPriceSell < position.TakeProfit)
                    {
                        ModifyPosition(position, newStopLossPriceSell, position.TakeProfit);

 

and vice versa for buy trades . .

 

 

 


@WinningTrader

Spotware
16 May 2014, 09:14

if newStopLoss has more decimal digits than current symbol has, you need compare rounded newStopLoss with current stop loss value. For example:

if (position.StopLoss != Math.Round(newStopLoss, symbol.Digits) || position.TakeProfit != Math.Round(newTakeProfit, symbol.Digits))
  ModifyPosition(position, newStopLoss, newTakeProfit);

 


@Spotware