Set a stop loss x units from the average position price.
Syntax:
1 |
Set STOP LOSS x |
Example :
1 2 3 4 5 6 7 8 9 |
myMACD = MACD[12,26,9](close) long = myMACD crosses over 0 IF NOT LongOnMarket AND long THEN BUY 1 CONTRACTS AT MARKET ENDIF //set stop loss at 50 pips from the average position price (on a 5 digits instrument) SET STOP LOSS 0.0050 |
Hi how do you add a loss after three consecutive losses ?
Is the stoploss refreshed on every close of the bar if x is variable after the position is opened?
Yes, you can change the stoploss of an order already opened.
Great, and the stop will be set x units from the “average” position price. The word average suggests that your position can consist of multiple entry prices (a scaled-in position), is this the case?
For IG or PRT sponsored account, the stoploss is set individually for each order. While it is on average price with paper trading through PRT software account.
that clarifies things, thank you Nicolas! also I noted that x can not be negative.
Negative stoploss is called takeprofit 🙂
Hi Nicolas, how would you code a % trailing stop, but not as a percentage of the average price, but rather on the profit, and only from a certain number of points of gain (to avoid being stopped out when the profit is only few ticks). I hope I am clear, so in other words, say I trade WallStreet DJI cfd, I want a stop loss of 12 points and then, once profit is, say, 20 points, enable a 50% profit trailing stop. So, at that point (20 pts profit) the trailing would be 10 points, and would rise according of position profit increase so that, at any point, I would never loose more than 50% of the accumulated profit. Is that possible with PRT language? Thank you.
Please open a new topic in ProOrder forum for custom coding requests.