Hi all,
Was wondering if it is possible to have multiple orders enter the market at the same time and each of those orders has their own TP level that os pre-determined. This is for scalping purposes.
Here is an example:
- If the buy condition is true, enter the market with a position size of 3 (so three 1 lot orders)
- TP for order 1 is 1 point
- TP for order 2 is 2 points
- TP for order 3 is 3 points
Hope this makes sense.
Here is a piece of my code:
if longpattern and tradecount < 2 then
buy 1 contract at high + 0.25 stop //I want two more orders here to enter the market each with their own TP value
set target pprofit 1
SLLong = abs((high + 0.25) - lowest[3](low)) + 0.25
set stop ploss SLLong
tradecount = tradecount + 1
endif
No, you can enter multiple times accumulating contracts/shares, but there will be only 1 SL and only 1 TP.
PRT does not allow to keep separate SL’s and TP’s for each trade entered.
In your example everytime line 5 is executed, the new SL will be set for ALL contracts/shares traded so far, no matter what time and price they were entered.
Thanks Roberto,
I appreciate your quick response!
Another way to deal with multiple takeprofit is by using partial closure of the global position, example in this blog article: Partial closure of positions when price is retracing : A complete function
Hi Nicholas,
Thanks.
My issue is that I need to take profit inta bar as it is a very fast in and out scalping strategy.
Will make use of MTF to test, but then I will have much less data though.
gfxParticipant
Average
Hi everyone,
Has this feature evolved since ?
Also, in the current question, orders are opened at the same time, which then makes sense to think about partial closing.
But what if scaling in ? For instance, first order is opened now, and 30 minutes later; a second, new, order is placed at a different price.
If SL/TP are set at second order, specific to the second order, does it mean that the current position, from first order, gets the SL/TP to inherit from the second order and are then updated at time second order is placed ?
If this, then the only solution would be not to place any SL/TP for the second order, and to handle all of it in the code. But I am not sure IG will accept an order without a SL. Any thoughts ?
Thks,
gfx
Any set target or set stop will affect all open orders, it means all orders will have the same TP and SL (distance from opened price).
So in order to create exit of one of the order, the best way to deal is to place pending sell or exishort orders at calculated price from the POSITIONPRICE which is the mean open price of the orders basket.
Hi Nicholas,
Can I also ask if I can setup different TP for multiple strategies of the same instrument? I found from some old post that strategies should be independent of each other. So different TP would be allowed?
Thanks in advance.