When I set a stoploss to a position I use the method invocation GenerateStopLoss(SL);
This expression does not contain the current price of the instrument. Is there a way to update the stoploss by using the current price?
For example, it should be something like this: UpdateStopLoss(CurrentPrice - NumberOfPips) for a long position.
Another question is that the expression GenerateStopLoss(SL) does not associate the stoploss with a specific position when multiple positions are open.
If there are two or more open positions, will the GenerateStopLoss(SL) expression affect all the open positions? Is there a way to modify only one of them?
Many thanks.
Issues with setting a stoploss [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Issues with setting a stoploss [SOLVED]
Hello ClarkFX,When I set a stoploss to a position I use the method invocation GenerateStopLoss(SL);
This expression does not contain the current price of the instrument. Is there a way to update the stoploss by using the current price?
For example, it should be something like this: UpdateStopLoss(CurrentPrice - NumberOfPips) for a long position.
You need to emulate the stoploss by sending the stop order with the price you need. This order can be replaced and modified.
You need to use ExitFromEntry orders.Another question is that the expression GenerateStopLoss(SL) does not associate the stoploss with a specific position when multiple positions are open.
If there are two or more open positions, will the GenerateStopLoss(SL) expression affect all the open positions? Is there a way to modify only one of them?
Many thanks.