Techincall Error when placing an order

Created at 25 Mar 2018, 18:01
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!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

Techincall Error when placing an order
25 Mar 2018, 18:01


Dear Panagiotis,

Let us say, a want to execute trade

"

...

SL=50.8

...

ExecuteMarketOrder(TradeType, Symbol, volume, label, SL, null)

...

"

With a regular currency pair there is no problem.

But if a  Symbol.Code="US500" I receive a "Techincal Error". It took me quite some time to realize, that when it comes to this Symbol, the Pip are expressed as an integer, not as a decimal. 

I tried to do smth. like "range/Symbol.PipSize", but the result is, for example 708.000000002 and that is "Technical Error" again.

How can I find programmaticaly the correct type of the pip for a Symbol?


@alexander.n.fedorov
Replies

alexander.n.fedorov
25 Mar 2018, 19:14

Techincall Error when placing an order

The solution that seem to be working:

"

private int PipDigits;

....
for (int i = 0; i <= Symbol.Digits; i++)
     {
             if (1 / Symbol.PipSize == Math.Pow(10, i))
             {
                 PipDigits = i;
                 break;
             }
       }

var StopLossInPips= Math.Round(range / Symbol.PipSize, PipDigits, MidpointRounding.AwayFromZero);

.....

"

But I don't think it is very elegant  :(

 


@alexander.n.fedorov

PanagiotisCharalampous
26 Mar 2018, 12:21

Hi Alexander,

See below

var PipDigits = Math.Log10(1 / Symbol.PipSize);

Best Regards,

Panagiotis


@PanagiotisCharalampous

alexander.n.fedorov
26 Mar 2018, 16:03

Dear Pangiotis, 

Nice and elegant. There is only one correction:

 

PipDigits=Symbol.Digits-Math.Log10(1 / Symbol.PipSize);

And then 

SL= Math.Round(range/Symbol.PipSize,0,AwayFromZero);

 

Thank you


@alexander.n.fedorov

alexander.n.fedorov
26 Mar 2018, 16:07

even like that:

int PipDigits = Symbol.Digits - (int)Math.Log10(1 / Symbol.PipSize);


@alexander.n.fedorov

acrigney
03 Feb 2021, 03:39

Technical Error when placing stop limit orders

Hi Guys,

I am trying to run my bot code that works fine on the minute but not on ticks. I use the TR but that is not available on ticks so I have just disabled that feature.

However I am getting "Technical Error" when placing my stop limit orders. This happens if I use expiry times or no expiry times. I am not sure if expiry times are even available on ticks for StopLimit orders?

Any tips would be really great! It would be nice to have a more descriptive error though?

 

Best Regards,

                      Alistair


@acrigney

acrigney
03 Feb 2021, 04:23

RE: Technical Error when placing stop limit orders
 

acrigney said:

I got this technical error for all these markets US30, AUDUSD, bitcoin, eth

Hi Guys,

I am trying to run my bot code that works fine on the minute but not on ticks. I use the TR but that is not available on ticks so I have just disabled that feature.

However I am getting "Technical Error" when placing my stop limit orders. This happens if I use expiry times or no expiry times. I am not sure if expiry times are even available on ticks for StopLimit orders?

Any tips would be really great! It would be nice to have a more descriptive error though?

 

Best Regards,

                      Alistair

 


@acrigney

PanagiotisCharalampous
03 Feb 2021, 08:38

Hi Alistair,

Can you share the cBot code and steps to reproduce like cBot parameters, dates etc?

Best Regards,

Panagiotis 

Join us on Telegram 

 


@PanagiotisCharalampous