The responses have 35=3 (MsgType = Reject). I'm not sure about TradingSessionID of IcMarkets (336=PRE-OPEN). How we can get the correct value for TradingSessionID of IcMarkets' cTrader ?
Hi there,
Message 35=g is not supported by cTrader FIX API. You can find the available messages in the link below
For the TP, my bot is managing multiple position at the same time, I have to change the TP when the position is opened. So the only option I was thinking about is to store in LocalStorage the TargetPrice for every position and then calculate manually the TP and modify it. Is it my only way?
More or less, yes, you would need to track the orders on your side. It would be better to use the label or comment and a guid to identify them though.
About the Stop Limit order entry, you say that the spread is irrelevant but on some US30 position yesterday I was not filled and I was thinking of the spread.
Let s say that the spread is 3 and I set a Long Stop Limit with a TargetPrice at 100 and a range at 2, is it possible to be filled?
Yes. The spread is not relevant, you need to look at the VWAP DoM instead.
The spread is irrelevant to the stop limit price. If you set a buy order at 100 and the range at 2, then what you are asking is the slippage not to exceed 2. Therefore the worst executed price will be 102 and only the volume that can fulfill this requirement will be filled. The spread is irrelevant, the bid price can be at 99 or 50.
Regarding TP, it can only be set in relative pips at the moment. If you need to set an exact price, you would have to modify the opened position.
It will be hard to get help by just throwing dozens of lines of code and ask for people why it doesn't work. This is because readers don't know what you expect the code to do and what it does instead. Even if they spend time interrogating you, then they will need to spend hours to figure out what you did wrong in your logic. Not many people have this surplus of time.
Did you try debugging your strategy first? Did you place a break point at the line where the conditions are evaluated to check what are the values when a trade is expected to be placed? It will help you understand why the trade is not placed when you expect it to do so.
You need to narrow down the problem to a question that can be answered by somebody in 10-15 minutes before asking for help.
PanagiotisCharalampous
05 Oct 2024, 06:20
Hi there,
Can you please share the cBot code so that we can reproduce the issue?
Best regards,
Panagiotis
@PanagiotisCharalampous