Not logged in
Viewing 2 posts - 1 through 2 (of 2 total)

Forums>StrategyQuant>Application Support>How to edit code to make SL/TP based on % of entry price

  • #113312 |
    Customer
    6 Posts

    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

    #128818
    Mark Fric
    Administrator
    1182 Posts

    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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.