Bracket order duplicates with automated trading

Questions about MultiCharts and user contributed studies.
jese514
Posts: 16
Joined: 11 Apr 2014
Has thanked: 2 times
Been thanked: 3 times

Bracket order duplicates with automated trading

Postby jese514 » 10 Jul 2014

If I turn off a strategy while there is an active order, obviously I click "Do Not Cancel Orders" when prompted about my bracket orders, so that the trade will be safe and complete on its own if automation never resumes.

Then when I re-enable automated trading, when prompted I "assign the initial chart position at the broker" to Long, to reflect my previous position. Then the problem arises: MC does not recognize the existing bracket orders, so it submits 2 new bracket orders with a new OCA group. I then have 2 targets and 2 stops, each pair sharing the same price, which will presumably mean I will get a -1 position rather than a flat position in the event that they are executed. This seems like a big problem. Is there anything I can do to prevent this? This is my bracket order code:

Code: Select all

SetProfitTarget( Target );
If BEonoff=true then SetBreakEven(BreakEven);
If TrailOnOff=false then setstoploss(stp);
If TrailOnOff=true and maxpositionprofit < TrailTrigger then setstoploss(stp);
If TrailOnOff=true then SetPercentTrailing(TrailTrigger,TrailPct);
I am using "AA" automaton mode.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bracket order duplicates with automated trading

Postby Henry MultiСharts » 10 Jul 2014

Hello jese514,

That is expected behavior. You need to manually manage the orders that are active at the moment you turn on the auto trading. At the moment PowerLanguage does not provide ability for that. This is something we are going to add in the new autotrading/backtesting engine.


Return to “MultiCharts”