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.
Issue Stop Loss order right after new position opened
- Polly MultiCharts
- Posts: 220
- Joined: 20 Jul 2022
- Has thanked: 1 time
- Been thanked: 59 times
Re: Issue Stop Loss order right after new position opened
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.
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.
- Polly MultiCharts
- Posts: 220
- Joined: 20 Jul 2022
- Has thanked: 1 time
- Been thanked: 59 times
Re: Issue Stop Loss order right after new position opened
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.
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.
Re: Issue Stop Loss order right after new position opened
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
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
- Polly MultiCharts
- Posts: 220
- Joined: 20 Jul 2022
- Has thanked: 1 time
- Been thanked: 59 times
Re: Issue Stop Loss order right after new position opened
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.
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.