I wonder if anyone can help… I’m trying to write code so that a new order is placed automatically if our stop is hit. For example we go long on the DAX with a stop of 14. The DAX falls and hits our stop. I then want to automatically open a new order to go short with a stop and limit in place for the new trade….
I assume your stop is a pending stop order? In that case the new order can be triggered at the open of the next bar. More instantly I think it is not possible with PRT.
Good idea Grahal! Might end up in some case that not both orders are filled simultaneously though.
Ah how stupid. Just place a stop order of double size so you end up with a switched position and don’t risk that only one side was filled. Jesus I better go to bed again. 🙂
Like I wrote above. Don’t use SET STOP PLOSS. Just place a normal stop order at the desired level but double the positionsize. Then you will end up with an reversed position.
BTW your code is much easier to read if you use the “insert code” function and not simply copy/paste it in the text.