i have a strategy that work in EURUSD pair and I want to add a protective stop loss when the current order reach a determinate level o profit. I want to add these protection in addition to traditional stop loss and take profit. Below the code. The strategy work in IG CFD account. It’s correct ?
1
2
3
4
5
6
7
8
9
10
11
12
13
//when the strategy reach a gain of 50$ set the breakeven with a profit of 5$
IfLongOnmarketand(close[1]-tradeprice)>=0.05then
sellat(tradeprice+0.005)limit
endif
//when the strategy reach a gain of 50$ set the breakeven with a profit of 5$
That way, your code will be universal with all traded instruments.
Also, to exit a long position below the actual price, you’ll have to use a STOP order and not a LIMIT one. It is the same to exit a short position (use STOP order instead).
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue