Getting tickvalue used by Stop Loss and Take Profit function

 

Hi

I would like to ask some help in my search for the correct tick value.
In both MT5 and MT4 the tickvalue is sometimes set in a different currency then the deposit currency. When you place an order and DRAG the order up or down to set TP or SL the "value" is based on deposit currency.

See the screenshot 
I printed the amount used with the tick value (amount of points) and then show the value of the SL
The tickvalue is in USD yet the displayed amount is in deposit value.

Now I would like to get the value  that is used by the SL / TP function so I can set the SL and TP using EA  (either based on % of account balance or based on fixed amount)
To do this I need to have the correct value of the tick.

Since the SL and TP function is achieving this I would like to know what function to use for me to achieve the same using an EA and calculate setting the SL or TP based on % or fixed amount.

The SL / TP function seems to auto converse from the set currency to the deposit currency yet I cant find anything about this in the MQL5 (or MQL4) documentation 


 

To calculate the SL and TP values in your EA, you'll need to use the appropriate functions to get the current tick value of the instrument and then apply your desired calculations (e.g., percentage of account balance, fixed amount) to determine the SL and TP levels in the deposit currency.

Some useful functions to consider:

  • SymbolInfoDouble("SYMBOL", SYMBOL_POINT) - returns the tick value (pip value) of the specified symbol.
  • AccountInfoDouble(ACCOUNT_BALANCE) - returns the current account balance.
  • OrderSend() - allows you to place orders with the calculated SL and TP values.

NOTE: The tick value represents the monetary value of one pip (the smallest price change) for the trading instrument. This tick value can be in a different currency than your account's deposit currency.

 

Forum on trading, automated trading systems and testing trading strategies

Getting the value of 1 tick (TP or SL)

Vladislav Boyko, 2024.04.02 22:20

Although the deposit is in EURO the tick value seems to be in $ USA

You are not the first to encounter this. Most likely, in the topics linked above there is a discussion of this

 
Oleksandr Medviediev #:
SYMBOL_POINT

Thank you for the answer.

I know the tick value can be in a different currency. That is why I want the value used by the Stop Loss and Take Profit function.
These values are in the deposit currency.