Issue Stop Loss order right after new position opened

Questions about MultiCharts and user contributed studies.
LMC1
Posts: 50
Joined: 28 Apr 2013
Has thanked: 29 times
Been thanked: 1 time

Issue Stop Loss order right after new position opened

Postby LMC1 » 05 Apr 2023

Hi,

I'm live testing a 15 minute bar trading strategy. I want to issue Stop Loss order right after a new position is opened, instead of pending until the beginning of the following bar.
Can anyone help? Thanks.

User avatar
Polly MultiCharts
Posts: 203
Joined: 20 Jul 2022
Has thanked: 1 time
Been thanked: 56 times

Re: Issue Stop Loss order right after new position opened

Postby Polly MultiCharts » 05 Apr 2023

Hello LMC1,

You might try using SetStopLoss for this purpose as this is a special exit order.
Any price orders (including special orders) can be executed intrabar, and generated only when the conditions for their generation are met (including intrabar generation) – both in backtesting and real-time.
If an entry appears, the exit order is generated at once, without waiting for the next calculation on the bar close or next tick. This behavior is not defined as “IOG”, an exit is always generated if there is an entry.
An exit order is generated any time a position is opened, even intrabar, if this exit order is NOT under condition which prevents its generation.

User avatar
Polly MultiCharts
Posts: 203
Joined: 20 Jul 2022
Has thanked: 1 time
Been thanked: 56 times

Re: Issue Stop Loss order right after new position opened

Postby Polly MultiCharts » 06 Apr 2023

LMC1,

Please note that in order to send Stop Loss orders intrabar, you will need to send them without conditions.
If StopLoss is under some conditions, it will be sent on the bar close.
So instead of using the condition ‘if marketposition <> 0 then’ you might try sending exit orders without conditions at all. If an entry appears, the exit order is generated at once, without waiting for the next calculation on the bar close or next tick.
You might use the pre-built Stop Loss signal for reference.

LMC1
Posts: 50
Joined: 28 Apr 2013
Has thanked: 29 times
Been thanked: 1 time

Re: Issue Stop Loss order right after new position opened

Postby LMC1 » 28 Jun 2023

Hi Polly,

Thanks. Just come back to continue the development.

I want to use these scripts but not sure if they will work as I need,

Stop$ = round( C * StopPercent , 2);
setstopcontract;
setstoploss( C - Stop$);

By the way, can I use "Entryprice" instead of "C" in above?

Thanks.
LMC1

User avatar
Polly MultiCharts
Posts: 203
Joined: 20 Jul 2022
Has thanked: 1 time
Been thanked: 56 times

Re: Issue Stop Loss order right after new position opened

Postby Polly MultiCharts » 29 Jun 2023

LMC1,

You can test this setup yourself to decide whether it suits your needs.
Please note that we always recommend testing your signals with our pre-built Paper Trader or with a demo broker account before going live.


Return to “MultiCharts”