What does trigger the profit target and stoploss

Questions about MultiCharts and user contributed studies.
Posts: 398
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 84 times
Been thanked: 123 times

What does trigger the profit target and stoploss

Postby evdl » 20 Apr 2012


I use the reserve words setprofittarget(amount) and setstoploss(amount) in my strategy. Using TWS IB and use autotrade MC.

What triggers the PT and SL, the bid or ask or last trade?

What occured the last 2 days that my PF or SL get hit at the end of the day, when the markets go in to there pre-close time. Normally in this period you see some price especially in the bid and ask that are far from the prices on the day. Resulting in hitting a PT or SL.

For example (see attachment) I had a position at average price 12,276 with PT of 13,315 and SL of 12,560. In the pre-close markets I see some bids at 13,705 and even 14,050 when the last price before the pre-close was 12,920.

In the autotrader settings I use the option "convert unexecuted limit/stop orders to market orders". And I think this is what happens: PT or SL get triggered in a flash and then MC converts the order to market and the position gets closed. But not at the trigger price but at market.

So what triggers the PT or SL. And is it better to not use the convert to market order option or is it not suppose to work this way.
trades at close.png
trades at close.png (161.03 KiB) Viewed 80 times

User avatar
Henry MultiСharts
Posts: 8447
Joined: 25 Aug 2011
Has thanked: 1207 times
Been thanked: 2704 times

Re: What does trigger the profit target and stoploss

Postby Henry MultiСharts » 20 Apr 2012

Hello Edwin,

Price series used for special orders (SetStopLoss, SetDollarTraling, etc.) trigger depends on the "Get Real-Time Data from" setting in the strategy properties.
If you select From Broker-asks and bids will be taken from the broker.
If you select From Chart-it depends on the BackTesting Mode.
If it is Classic – Data1 price series will be used, Extended –Ask and Bid data series will be used.

Example: Autotrading mode is Async, Get Real-Time from Chart is selected, there is an executed entry and a trailing stop is sent. The trailing order price is calculated based on the entry order fill price at the broker and the real-time price from the chart.

If you have the option "convert unexecuted limit/stop orders to market orders" then an entry/exit order can be converted into a market order when price level is hit but the order is not filled due to long order queue.
These users thanked the author Henry MultiСharts for the post:

Return to “MultiCharts”