No one? Couldn't find an answer in the forum or anywhare in mql4.com but i've managed to find the solution!
Lot Size
https://forum.mql4.com/37352#403025
MathFloor(var1*100)/100.;
Subgenius: My lot size is more than two decimals. If I want to display the value of lot * a takeprofit value..
StrToDouble(StringSubstr(DoubleToStr(NewLot),5,StringLen(NewLot)))*TakeProfit1
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- Post the real code, DoubleToStr - MQL4 Documentation requires two arguments, so your posted code will not even compile. I assume a typo of DoubleToStr(NewLot,5)
- That code is equivalent to NormalizeDouble(NewLot,5)*TakeProfit1 and since NewLot doesn't have more than five significant digits, is equivalent to just NewLot. If you "want to display the value of lot * a takeprofit value," then just do that:
DoubleToStr(NewLot * TakeProfit1, 2); // Currency to 2 places.
- Your real problem is that you must normalize your NewLot to what your broker requires.
WHRoeder:
- That code is equivalent to NormalizeDouble(NewLot,5)*TakeProfit1 and since NewLot doesn't have more than five significant digits, is equivalent to just NewLot. If you "want to display the value of lot * a takeprofit value," then just do that:
- Your real problem is that you must normalize your NewLot to what your broker requires.
well,
i send NewLot normalized double in the third decimal which looks like 0.0368 and the broker opens an order with 0.03..
when i'm trying to display this 0.03 * 5 take profit it wasn't looking like 0.15 but instead 0.0368 * 5 = 0.184 and the takeprofit value was 15 cents, not 18 cents
i said i have got it resolved using math floor but using strings and normalize didnt work
im with fx choice
Subgenius: looks like 0.0368 and the broker opens an order with 0.03.. |
What part of Your real problem is that you must normalize your NewLot to what your broker requires. was unclear?
|
Subgenius:
Thanks Subgenius :) Hope you don't mind me using your formula :)
No one? Couldn't find an answer in the forum or anywhare in mql4.com but i've managed to find the solution!
Lot Size
https://forum.mql4.com/37352#403025
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerlot + CommissionPerLot) (Note OOP-OSL includes the SPREAD)
- Do NOT use TickValue by itself - DeltaPerlot
- You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
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
If I want to display the value of lot * a takeprofit value..
My lot size is more than two decimals but the order shows only 2 decimals ("0.03") which I cannot seem to get.
For instance: Takeprofit is "0.5" pips, Lotsize is "0.0368" and I 'm trying to see "TP1 Value: 0.15"
How do we do it without rounding it? Do we turn it into a string and then back into a double?
If so, this doesnt work: