PlaceLimitOrder does not execute position at exact price set in SubmittedPrice in Linear Gradient
PlaceLimitOrder does not execute position at exact price set in SubmittedPrice in Linear Gradient
10 Mar 2022, 19:54
I was chatting with @pcharalampous on Telegram and he requested to open a call here.
An example back test at Pepperstone (I did this same test at Icmarkets and it has the same behavior).
As you can read in the code, we can see that except the first two "mother orders" are market orders, setting the base price for the children orders, while the next general flow is only used limit order. Except when it reaches a stop loss (line 320) that I use PlaceStopLimitOrder.
What is expected from this robot:
1) It runs OnTick;
2) Post mother order and set the price for the children orders;
3) When the position reaches the take profit, on the next tick launch a new PlaceLimitOrder at the same entry price of the closed take profit order;
4) When the position reaches the stop loss, in the following tick post a new PlaceStopLimitOrder at the same entry price of the order closed by stop loss;
Considering this premise, all executed orders that turned positions and had profit or loss, should be posted at the grid price.
As an example I send the following video from the link: "https:// drive.google.com/drive/folders/1iJoAdK8wwfjYvmfXsY5l-XkUkC3XE2r3?usp=sharing" demonstrates that the "PlaceLimitOrder" orders are not executed at the price they should. Also at this link is the robot code and the set used.
The interval between orders in this .set is 5 pips.
In this video, the start price of the buy children orders should always end at 2 and the sell children orders should always end at 0.
I am at your disposal to chat, I know Spanish (as long as you speak it slowly). English for text, I'm learning.
Replies
janiodesouza
11 Mar 2022, 15:37
Based on your explanation, I now understand. I have this same robot in NinjaTrader 8, trading B3 in Brazil. Here we do not have the possibility of best price, only the price we set in case of limit order.
Based on this, I will adjust my code to maintain in another way the price range for posting the child orders, re-orders following.
Thank you
@janiodesouza
PanagiotisCharalampous
10 Mar 2022, 20:27
Hi janiodesouza,
I don't see any problem. I saw your video, I just tried this and all limit orders are executed at the requested price or better. Can you please point to one limit order that is executed at a worse price than the target price?
Best Regards
Panagiotis
@PanagiotisCharalampous