Hi. Is it possible to write code that sets your open positions SL to entry/breakeven once the trade has move positively into your direction with a certain number of points?
Yes you can but the problem is that you probably stop very very often because you have generally à retracement before the impulsion in the good direction.
See on Google the concept of maximum adverse excursion
Your first code set will deactivate the SELL AT newSL STOP once the preceding IF statement is not true anymore, correct? So when close-tradeprice(1)>=30*pipsize is not true will the exit not work anymore until it becomes true again?
Why do you use the (1) after tradeprice? What does it do?
Hi David, didn’t see the Gunnernic reply before, so here is the answers for your 3 questions:
1/ Gunnernic’ code will not work because PLOSS needs point information and not price one
2/ Once this conditional statement is true one time, newSL will take its value. Since we do not use “else”, newSL will keep its value until a new one will be affected to it.
3/ (1) is the previous number of the order we want to look at
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