Download MetaTrader 5
To add comments, please log in or register
Having a great idea? Share it on the traders' Forum!
MisterDog
380
MisterDog 2014.05.12 03:08 

I would like to add another sell stop / buy stop to take some profits early.

I am placing an order with a take profit and stoploss with code something like this

orderResult=OrderSend(Symbol(),OP_BUYSTOP,lotAmount,somePrice,3,someStopPrice,someTakeProfitPrice,"",Magic,0,clrGreen);

Next how do I take some profit halfway between the order open price and order stop loss? I was hoping to do something like this but it doesn't seem to work. I get a 130 -- invalid stops error.

orderResult=OrderSend(Symbol(),OP_SELLSTOP,lotAmount/2,Ask+halfWayToStop,3,0,0,"",Magic,0,clrGreen);
Eric Venturi-Bloxs
51
Eric Venturi-Bloxs 2014.05.12 06:16  

Your SELLSTOP can't work like this.

You have 2 solutions:

1/ You set 2 BUYSTOP at the same price with 1/2 lot size and with different TakeProfits.

2/ You set only 1 BUYSTOP ... and when profit reach your 1st goal, close 1/2 the position.

MisterDog
380
MisterDog 2014.05.12 08:20  
Thanks for the idea. Option one works great for me.
qjol
3243
qjol 2014.05.12 09:12  
Eric_:

Your SELLSTOP can't work like this.


sure it can work that way

you have to change to OP_SELLLIMIT not OP_SELLSTOP

Eric Venturi-Bloxs
51
Eric Venturi-Bloxs 2014.05.12 11:19  
qjol:

sure it can work that way

you have to change to OP_SELLLIMIT not OP_SELLSTOP



He will end with hedged position which I doubt that it's what he want ...
qjol
3243
qjol 2014.05.12 11:38  
Eric_:

He will end with hedged position which I doubt that it's what he want ...

i thought about it
maybe he is using a U.S. broker then it will not happen
Eric Venturi-Bloxs
51
Eric Venturi-Bloxs 2014.05.12 11:44  
qjol:

i thought about it
maybe he is using a U.S. broker then it will not happen

Yes but what will be the purpose of having an additional SELL position while he just need to do a partial close at Xpips for the initial BUY position ?
qjol
3243
qjol 2014.05.12 11:54  

i think you dont get it

if he uses a U.S.A broker when the OP_SELLLIMIT gets triggered if he has an open buy position of 0.2 lots the selllimit isn't gonna open another sell of 0.1 lot but it's gonna close 0.1 from the buy position

try for yourself on a demo account with a U.S.A. broker

whroeder1
13627
whroeder1 2014.05.12 13:05  
qjol: try for yourself on a demo account with a U.S.A. broker
Totally broker dependent. Mine just deletes the pending order on trigger.
Eric Venturi-Bloxs
51
Eric Venturi-Bloxs 2014.05.12 15:49  
qjol:

i think you dont get it

if he uses a U.S.A broker when the OP_SELLLIMIT gets triggered if he has an open buy position of 0.2 lots the selllimit isn't gonna open another sell of 0.1 lot but it's gonna close 0.1 from the buy position

try for yourself on a demo account with a U.S.A. broker


Got it! So in this case, you were right : the order must be a LIMIT not a STOP.
MisterDog
380
MisterDog 2014.05.13 01:08  

Yes I am with a U.S.A. broker.

I have written a program that closes half a position when it gets halfway to the stop. However I want to be able to adjust these two take-profit lines by dragging them. This way I can visually set them exactly where I want them on the chart.

I will try the idea of adding a LIMIT rather than a STOP.

I've also found a good solution by simply opening two orders at the same time. They both have the same stop-loss value. They have two different take profits values. This works well.

Now I can take profit with a quick scalp and be set up for a longer swing trade.

/
To add comments, please log in or register