Stop Loss/Take Profit problem

 

Ok I have a problem. When I set up by open like this it works.

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,0,0,"expert comment",255,0,CLR_NONE);

But when I put in my stop loss and my take profit it doesn't. I've tried the 3 following variations but to no avail.

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,20,30,"expert comment",255,0,CLR_NONE);

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,100,100,"expert comment",255,0,CLR_NONE);

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,stopLoss,takeProfit,"expert comment",255,0,CLR_NONE);

 

Point

caldolegare:
Ok I have a problem. When I set up by open like this it works.

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,0,0,"expert comment",255,0,CLR_NONE);

But when I put in my stop loss and my take profit it doesn't. I've tried the 3 following variations but to no avail.

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,20,30,"expert comment",255,0,CLR_NONE);

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,100,100,"expert comment",255,0,CLR_NONE);

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,stopLoss,takeProfit,"expert comment",255,0,CLR_NONE);

caldolegare,

Try this:

ticket1=OrderSend(Symbol(),OP_SELL,1.0,Bid,0,Bid+20*Point,Bid-30*Point,"expert comment",255,0,CLR_NONE);

Note:Pointfunction returns the point size of the current currency symbol.

For example: if you trade EURUSD the point value = .0001 and if you trade EURJPY the point value should be .01

So, you have to convert your stoplossand takeprofit values to points before using them with OrderSendor OrderModifyfunctions.

 

tnx

nice

)

 

i'm placing this question here as i didn't want to start a new thread...

I've tried every thing i could (read the help file, look online...) and i'm still stumped. . .

Say i'm long on the GbpUsd at 1.9000 with 60 lots and i wish to take 20 partial lots in profit at 1.9050, another 20 lots in profit at 1.9100 and let the final 20 lots ride with a 50 pip trailing stop.

I've tried everything that is listed in the HELP menu under "Take Profit" and all i get is new Sell Limit orders for 20 lots executed at the levels set and still have the original 60 lots still running.

I've never really addressed this issue in MT4 as i've always traded in my FXSol account without any issues in this area... how is this pulled off in MT4?? It is not apparently by the HELP instructions that i'm reading and implementing.

THANK YOU IN ADVANCE... yes i was yelling that from the rooftop!

Cheers,

Thom

 
accrete:
Say i'm long on the GbpUsd at 1.9000 with 60 lots and i wish to take 20 partial lots in profit at 1.9050, another 20 lots in profit at 1.9100 and let the final 20 lots ride with a 50 pip trailing stop.

I don't think it's possible. MT works with Order, you can open it, modify or delete but the full order. The only way to split existing order is command OrderCloseBy. So, if you are long with 60 lots and want to close 20 lots, you should open one more order - short with 20 lots and after that use OrderCloseBy(ticket_long, ticket_short). As result you will stay with one order long with 40 lots only. You can use that command in EA or in script if you trade manually.

Some brokers may not support that command.

Reason: