![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Thanx again Alain
IT WORKS - But i must say i dont get it -> i missed WHAT IS A TICK.
So i g**gl tick is a minimum price change and can be everything - for example 0,25 then 4 ticks are ... and here is the question pips or points i dont know.
but when i now a tick is 0.25 mySL is 500_Points i end up with (500/.025=) 2000_ticks
now i know my tick value is 0.28_USD i can multiplie (2000_ticks * 0.28_USDbyTick) 560_USD
i think i understand the principle by now
here i have a cooding problem what does the "?" and what is with the ":"
NEW TO ME ??
Found anwer here: https://www.mql5.com/en/docs/basis/operators/ternary
OK if i get everithing right i end up wit this function:
Percen = double 2.15
Points = 500 POINT
base is the lower: Equity or Balanc value
returns double for Lot ATTENTION ==> minimum 0.01 so you do not get an error opening positions with Lot 0 - but in this case it can be more than % value !!
(Basicly turned Alains idea into a function) - this function looks fine for me. Do i miss something?
OK if i get everithing right i end up wit this function:
Percen = double 2.15
Points = 500 POINT
base is the lower: Equity or Balanc value
returns double for Lot ATTENTION ==> minimum 0.01 so you do not get an error opening positions with Lot 0 - but in this case it can be more than % value !!
(Basicly turned Alains idea into a function) - this function looks fine for me. Do i miss something?
Of course the code I provided is only to illustrate the needed calculation.
You need to normalize your lotsize and check against minimum and maximum allowed by the broker.
Vladimir Karputov: Not quite right. I did not take into account the level of margin.
@ Alain - In my code lots are splitet up to 3 trades, this is when i cheque ;-) THNX
@ whroeder - i have seen your post before but i wos not able to understand it then... now i untherstand TICKVALUE now it works....