Placing Stop Order - FAILED with error "TechnicalError"

Created at 02 Sep 2024, 19:07
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!
SE

sebastien.t

Joined 12.03.2024

Placing Stop Order - FAILED with error "TechnicalError"
02 Sep 2024, 19:07


Good day,

 

I have that code to test to place a Stop Order on A demo account with ICMarkets :

 

protected override void OnStart()

{

// Get the closed bar

var closedBar = Bars[Bars.Count - 47];

// Get the open time of the closed bar

DateTime barTime = closedBar.OpenTime;

 

if (barTime.Hour == 7 && barTime.Minute == 30){

_high15 = closedBar.High;

_low15 = closedBar.Low;

 

double buyStopLoss = _low15;

double sellStopLoss = _high15;


double takeProfit = TakeProfitInPoints * Symbol.TickSize;

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", sellStopLoss, _low15 - takeProfit);

}

}

 

I get always the error 

 Trade | → Placing Stop Order to Sell 10 DE30 (Price: 18772.6, SL: 18831.6, TP: 18722.6) FAILED with error "TechnicalError"

 

Could you help?


@sebastien.t
Replies

PanagiotisCharalampous
03 Sep 2024, 05:50

Hi there,

You are setting the SL and TP is absolute price. You need to set them in pips.

Best regards,

Panagiotis


@PanagiotisCharalampous

sebastien.t
03 Sep 2024, 06:52 ( Updated at: 03 Sep 2024, 07:39 )

RE: Placing Stop Order - FAILED with error "TechnicalError"

Hello,

 

thank you for your answer.

 

I modified the code to respect the Ticksize. I still get an error

Trade | → Placing Stop Order to Sell 10 DE30 (Price: 18772.6, SL: 5700, TP: 5000) FAILED with error "TechnicalError"

 

I also tried to use the Pipsize :

But I have the same issue Trade | → Placing Stop Order to Sell 10 DE30 (Price: 18772.6, SL: 570, TP: 500) FAILED with error "TechnicalError"

 

Thank you for your help.

 

PanagiotisCharalampous said: 

Hi there,

You are setting the SL and TP is absolute price. You need to set them in pips.

Best regards,

Panagiotis

 


@sebastien.t

PanagiotisCharalampous
03 Sep 2024, 08:50

RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

sebastien.t said: 

Hello,

 

thank you for your answer.

 

I modified the code to respect the Ticksize. I still get an error

Trade | → Placing Stop Order to Sell 10 DE30 (Price: 18772.6, SL: 5700, TP: 5000) FAILED with error "TechnicalError"

 

I also tried to use the Pipsize :

But I have the same issue Trade | → Placing Stop Order to Sell 10 DE30 (Price: 18772.6, SL: 570, TP: 500) FAILED with error "TechnicalError"

 

Thank you for your help.

 

PanagiotisCharalampous said: 

Hi there,

You are setting the SL and TP is absolute price. You need to set them in pips.

Best regards,

Panagiotis

 

Please share the complete cBot code, your cBot parameters and backtesting settings, as well as your broker, so that we can reproduce this on backtesting.


@PanagiotisCharalampous

sebastien.t
03 Sep 2024, 13:31

RE: RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

My broker is ICMarkets and here is the simple code, I just put an order. It could be anything a Market order or a stop order, i have always the Failure message.

 

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.Indicators;

using System;


 

namespace cAlgo.Robots

{

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

public class StopLimitOrdersAt915 : Robot

{

private double _high15;

private double _low15;

 

[Parameter("Volume (in units)", DefaultValue = 10)]

public int VolumeInUnits { get; set; }

 

[Parameter("Offset (points)", DefaultValue = 20)]

public double OffsetInPoints { get; set; }

 

[Parameter("Take Profit (points)", DefaultValue = 50)]

public double TakeProfitInPoints { get; set; }


protected override void OnStart()

{

var closedBar = Bars[1];

_high15 = closedBar.High;

_low15 = closedBar.Low;
 

double sellStopLoss = OffsetInPoints / Symbol.PipSize;
 

double takeProfit = TakeProfitInPoints / Symbol.PipSize;

double StopLoss= (_high15-_low15)/Symbol.PipSize

 

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", StopLoss, takeProfit);
 

}


}

}


@sebastien.t

PanagiotisCharalampous
04 Sep 2024, 05:20

RE: RE: RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

sebastien.t said: 

My broker is ICMarkets and here is the simple code, I just put an order. It could be anything a Market order or a stop order, i have always the Failure message.

 

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.Indicators;

using System;


 

namespace cAlgo.Robots

{

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

public class StopLimitOrdersAt915 : Robot

{

private double _high15;

private double _low15;

 

[Parameter("Volume (in units)", DefaultValue = 10)]

public int VolumeInUnits { get; set; }

 

[Parameter("Offset (points)", DefaultValue = 20)]

public double OffsetInPoints { get; set; }

 

[Parameter("Take Profit (points)", DefaultValue = 50)]

public double TakeProfitInPoints { get; set; }


protected override void OnStart()

{

var closedBar = Bars[1];

_high15 = closedBar.High;

_low15 = closedBar.Low;
 

double sellStopLoss = OffsetInPoints / Symbol.PipSize;
 

double takeProfit = TakeProfitInPoints / Symbol.PipSize;

double StopLoss= (_high15-_low15)/Symbol.PipSize

 

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", StopLoss, takeProfit);
 

}


}

}

Please let us know the symbol as well. I tried this on EURUSD and works fine


@PanagiotisCharalampous

sebastien.t
04 Sep 2024, 05:35

RE: RE: RE: RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

i was working on the DE40
 

 

PanagiotisCharalampous said: 

sebastien.t said: 

My broker is ICMarkets and here is the simple code, I just put an order. It could be anything a Market order or a stop order, i have always the Failure message.

 

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.Indicators;

using System;


 

namespace cAlgo.Robots

{

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

public class StopLimitOrdersAt915 : Robot

{

private double _high15;

private double _low15;

 

[Parameter("Volume (in units)", DefaultValue = 10)]

public int VolumeInUnits { get; set; }

 

[Parameter("Offset (points)", DefaultValue = 20)]

public double OffsetInPoints { get; set; }

 

[Parameter("Take Profit (points)", DefaultValue = 50)]

public double TakeProfitInPoints { get; set; }


protected override void OnStart()

{

var closedBar = Bars[1];

_high15 = closedBar.High;

_low15 = closedBar.Low;
 

double sellStopLoss = OffsetInPoints / Symbol.PipSize;
 

double takeProfit = TakeProfitInPoints / Symbol.PipSize;

double StopLoss= (_high15-_low15)/Symbol.PipSize

 

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", StopLoss, takeProfit);
 

}


}

}

Please let us know the symbol as well. I tried this on EURUSD and works fine

 


@sebastien.t

sebastien.t
04 Sep 2024, 08:10

RE: RE: RE: RE: RE: RE: Placing Stop Order - FAILED with error "TechnicalError"

I found the stupid issue. I was using the old ticker DE30 (but still available for this broker…) instead of the good new one DE40…

 

Now it s working perfectly!

 

Thank you for your support

 

sebastien.t said: 

i was working on the DE40
 

 

PanagiotisCharalampous said: 

sebastien.t said: 

My broker is ICMarkets and here is the simple code, I just put an order. It could be anything a Market order or a stop order, i have always the Failure message.

 

using cAlgo.API;

using cAlgo.API.Internals;

using cAlgo.Indicators;

using System;


 

namespace cAlgo.Robots

{

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

public class StopLimitOrdersAt915 : Robot

{

private double _high15;

private double _low15;

 

[Parameter("Volume (in units)", DefaultValue = 10)]

public int VolumeInUnits { get; set; }

 

[Parameter("Offset (points)", DefaultValue = 20)]

public double OffsetInPoints { get; set; }

 

[Parameter("Take Profit (points)", DefaultValue = 50)]

public double TakeProfitInPoints { get; set; }


protected override void OnStart()

{

var closedBar = Bars[1];

_high15 = closedBar.High;

_low15 = closedBar.Low;
 

double sellStopLoss = OffsetInPoints / Symbol.PipSize;
 

double takeProfit = TakeProfitInPoints / Symbol.PipSize;

double StopLoss= (_high15-_low15)/Symbol.PipSize

 

PlaceStopOrder(TradeType.Sell, SymbolName, VolumeInUnits, _low15, "Sell Stop Limit Order", StopLoss, takeProfit);
 

}


}

}

Please let us know the symbol as well. I tried this on EURUSD and works fine

 

 


@sebastien.t