Quick SL and TP Q
Forums › ProRealTime English forum › ProOrder support › Quick SL and TP Q
- This topic has 4 replies, 3 voices, and was last updated 6 years ago by Despair.
-
-
10/23/2017 at 7:47 AM #50273
Hey guys, I have a quick question about SL and TP. Is it possible to have one SL/TP for the long side and one for the short side in the same code? 🙂
Like this:
12345678910111213141516// Stops and targetsSLL = 50TPL = 50if longonmarket thenSET STOP pLOSS SLLsET TARGET pPROFIT TPLENDIFSLS = 40TPS = 40if SHORTonmarket thenSET STOP pLOSS SLSsET TARGET pPROFIT TPSENDIF10/23/2017 at 9:16 AM #50280It is possible but you can not use the SET command. Look here:
1234567891011121314SLL = 50TPL = 50if longonmarket thensell at TPL limitsell at SLL stopENDIFSLS = 40TPS = 40if SHORTonmarket thenexitshort at TPS limitexitshort at SLS stopENDIF10/23/2017 at 3:02 PM #5033110/26/2017 at 2:59 PM #50615Thanks for answering the Joachim’s question but I do not understand your code. The code Joachim shared in his post should work fine to me.
In your code:
123456SLL = 50TPL = 50if longonmarket thensell at TPL limitsell at SLL stopENDIFthe long orders will close at 50, which will never be possible if the current instrument quote at 13000 for instance. I think Joachim would like to set its takeprofit and stoploss in points, not in price.
10/26/2017 at 3:42 PM #50626You are correct Nicolas. I forgot to add the trade price. The think Joachim wanted to achieve is that he has different TP and SL for short and long.
1234567891011121314SLL = 50*pipsizeTPL = 50*pipsizeif longonmarket thensell at TPL+tradeprice(1) limitsell at tradeprice(1)-SLL stopENDIFSLS = 40*pipsizeTPS = 40*pipsizeif SHORTonmarket thenexitshort at tradeprice(1)-TPS limitexitshort at tradeprice(1)+SLS stopENDIF -
AuthorPosts