- ago
Hello Community,
Can I use bracket orders to trade with Wealth Lab and Interactive Brokers? I would like that my entry, take profit and stop loss orders are placed with the broker simultaneously, but did not find the possibility.
Thank you for the answer
Natalia
0
201
Solved
4 Answers

Reply

Bookmark

Sort
- ago
#1
Hello,

A possible way to assign auto profit target and stop loss prices is to use the AssignAutoStopTargetPrices method in your C# strategy. The QuickRef contians more info and sample code:
CODE:
public virtual void AssignAutoStopTargetPrices(Transaction t, double basisPrice, double executionPrice)

OCO (One-Cancel-Other) orders are supported by the Order Manager.
0
Best Answer
Cone7
- ago
#2
First, make sure to select it in Preferences > Trading > Special Order Types > OCO

For a programmed solution, as Eugene suggests, use the AssignAutoStopTargetPrices solution. See the example in the QuickRef > UserStrategyBase > StrategyExecution > AssignAutoStopTargetPrices. You need to add the override method.

For manual entry, Stage both orders, select them and Place. (See the Help for the Preference)
1
- ago
#3
Thank you for your answers.
I'm trying to set up a trading system without programming.
So, I activated OCO and tested how it works.
1. When the signal came from the strategy, there was only one order placed - the entry (Buy)
2. With the next run (I use 30 Minutes period) there were two orders placed - my profit target and the stopLoss.
3. During the following 30 minutes neither of the exits was triggered and both orders were cancelled with the next run. No reason was notified in the log, just that it is cancelled.
For me it is not acceptable, I expect that the exit orders are placed with the very moment as the entry order. In half an hour the prices could drift far away and I could be in a loss more than I have expected.
And why the exit orders were cancelled, is not at all clear....
0
Cone7
- ago
#4
QUOTE:
I'm trying to set up a trading system without programming.
At this time, it's not possible to activate same-bar exits with Building Block Strategies. You need to follow the programming pattern for AssignAutoStopTargetPrices in a C# Coded strategy to activate those orders as soon as the entry order is filled.

A strategy needs to keep orders alive for each bar, else they are canceled. If you share an example, we could check it for you.
0

Reply

Bookmark

Sort