Reply

How to edit code to make SL/TP based on % of entry price

1 replies

kong_28

Customer, bbp_participant, community, 45 replies.

Visit profile

9 years ago #113312

Hi Mark,

      

          I would like to adjust code for meta trader to make SL/TP based on % of entry price. Is it possible to add or replace

some code from the original SQ template ?  If so, please help me for that code as following condition :

 

For long positions:
Profit target price = Entry price x (1+T/100)
Stop-loss price = Entryprice  x (1 – S/100)
 
For short positions:
Profit target price = Entry price x (1-T/100)

Stop-loss price = Entry price x (1+S/100) 

 

           I will use your code to edit my EA manually.

 

Thanks,

Sarids

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #128818

Hello,

 

yes, this seems to be correct computation.

 

You can edit it in the function openOrderWithErrorHandling() – there the EA places the order and then its SL and PT.

You can use MQL function OrderOpenPrice() to get the actual entry price.

Mark
StrategyQuant architect

0

Viewing 1 replies (of 1 total)