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:08
You might find something useful here:
https://www.mql5.com/en/forum/386090
https://www.mql5.com/en/forum/373815
https://www.mql5.com/en/forum/371602
https://www.mql5.com/en/forum/443894
https://www.mql5.com/en/forum/441959
I found this in my browser bookmarks. I didn't re-read this before giving you the links.
[EDIT]
Here's a couple more links:
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
You are not the first to encounter this. Most likely, in the topics linked above there is a discussion of this
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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