"technical error" on placing a limit order

Created at 27 Feb 2019, 11:44
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!
SH

Shares4UsDevelopment

Joined 14.10.2018

"technical error" on placing a limit order
27 Feb 2019, 11:44


I get a "technical error" on placing a limit order, it only happens in LIFE mode not in backtesting

?

1

tradeOperation1 =  PlaceLimitOrderAsync(TradeType.Buy, Symbol, 1, symbol.Ask + symbol.PipSize, "", null, 1,  Server.Time.AddMilliseconds(100));

 

Someone any idea?

Reply

ReplySubscribe

 


@Shares4UsDevelopment
Replies

PanagiotisCharalampous
27 Feb 2019, 11:47

Hi Ton,

Try rounding the target price to the Symbol digits.

Best Regards,

Panagiotis


@PanagiotisCharalampous

Shares4UsDevelopment
27 Feb 2019, 11:49

RE:

Shares4UsDevelopment said:

I get a "technical error" on placing a limit order, it only happens in LIFE mode not in backtesting

?

1

tradeOperation1 =  PlaceLimitOrderAsync(TradeType.Buy, Symbol, 1, symbol.Ask + symbol.PipSize, "", null, 1,  Server.Time.AddMilliseconds(100));

 

Someone any idea?

Reply

ReplySubscribe

 

or: what is the closest way of sending a FOK order (Fill Or Kill) or (IOC fill available, cancel the rest)

 


@Shares4UsDevelopment

Shares4UsDevelopment
27 Feb 2019, 11:52

Hi Panagiotis,
I'll try, but do you know of a better way to simulate FOK or IOC orders?

 


@Shares4UsDevelopment

PanagiotisCharalampous
27 Feb 2019, 12:16

Hi Ton,

There is no way to simulate a FOK at the moment. All orders feature partial execution. IOC is available only for market orders so you can try a marker mrder with a market range.

Best Regards,

Panagiotis 


@PanagiotisCharalampous

Shares4UsDevelopment
27 Feb 2019, 18:06

tradeOperation1 =  PlaceLimitOrderAsync(TradeType.Buy, Symbol, 1, Math.Round(Symbol.Ask + Symbol.PipSize, Symbol.Digits), "", null, 1,  Server.Time.AddMilliseconds(100));
                  

It;s a pitty but that did not work :-(

 


@Shares4UsDevelopment

Shares4UsDevelopment
27 Feb 2019, 19:22

RE:

Panagiotis Charalampous said:

Hi Ton,

There is no way to simulate a FOK at the moment. All orders feature partial execution. IOC is available only for market orders so you can try a marker mrder with a market range.

Best Regards,

Panagiotis 

Hi Panagiotis,

Isn't this the closest you can get to FOK (if it can't get filled it's cancelled isn't it)

PlaceStopOrder(TradeType.Buy, symbol, Vol, symbol.Bid, "o1", null,0);

Or is this one closer? (if it can't get filled it's cancelled agetr a few milliseconds. Isn't it)

PlaceStopLimitOrder(TradeType.Buy, symbol, Vol, symbol.Bid,0, Orderlabel,null,null,Server.Time.AddMilliseconds(ExpireMiliSeconds));

@Shares4UsDevelopment

PanagiotisCharalampous
28 Feb 2019, 09:28

Hi Ton,

I just noticed that you set the expiry time 100 ms after the current time. That could be the source of the problem, since until is placed it might have already expired. 

Regarding "if it can't get filled it's cancelled isn't it" the answer is no, it will be filled partially and the rest cancelled. FOK means either filling it completely or killing it.

Best Regards,

Panagiotis


@PanagiotisCharalampous

Shares4UsDevelopment
28 Feb 2019, 22:07

RE:

Hi Panagiotis


I'll test with a longer expiry time! good suggestion. But I thought accepting an order would not take more than 20ms or so + 20 ms for confirmation.

If that's the case Ill have to find a faster provider.  ;-)

What I also found is that Servertime (UTC+x) is not the time the order is arriving at the broker (UTC+y) !!
I sent expiration = Servertime 09:00 and get back from the broker its "10::00 here"???
Which server is "Server.Time" based on? at Spotware, at the broker, at .....?
 i'll test with DateTime.Now to see if that differs.

So what you say is that:

PlaceStopOrder(TradeType.Buy, symbol, Vol, symbol.Bid, "o1", null,0);

Is like an IOC order.

and:

PlaceStopOrder(TradeType.Buy, symbol, Vol, symbol.Bid, "o1", null,0,DateTime.Now.AddMilliseconds(200) );

Is as close to a FOK as you can get ( immediately. meaning within 200ms here)


@Shares4UsDevelopment

PanagiotisCharalampous
01 Mar 2019, 10:34

Hi Ton,

Server.Time is the time of your broker's server based on the timezone you set for the cBot. 

Regarding the order types, both of the examples you posted are IOC orders. It means on triggering the order, fill whatever you can immediately and cancel the rest. On the other hand a FOK orders means fill the order immediately and completely or do not fill it at all. Since all orders in cTrader allow partial execution there is no way to satisfy the completely part of a FOK order.

Best Regards,

Panagiotis


@PanagiotisCharalampous

Shares4UsDevelopment
01 Mar 2019, 12:00

RE: fill whatever you can immediately

Hi Panagiotis:

I love the responsiveness of CTDN!

you said:

fill whatever you can immediately 

That pops up the question:
{
   What is the use of an expirationtime then? (lagging Liq.Prov. maybe??) && 
   What is the definition of immidiately here? 
} ||
{
    Where in the documentation can I find a clear and exhaustive elaboration on these (for me important) issues?
}
 

Best rgds,
Ton


@Shares4UsDevelopment

PanagiotisCharalampous
01 Mar 2019, 12:10

Hi Ton,

Immediatelly means on the existing liquidity. If the existing liquidity at the time of filling the order is not adequate to fill the order, then the order not filled is cancelled. It will not wait for new liquidity. Investopedia is a good resource for such definitions. 

Best Regards,

Panagiotis


@PanagiotisCharalampous