• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 5:15am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 5:15am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Filtering 5 decimal to work with 4 decimal bots 2 replies

How to change MA code from 5 decimal to 4 decimal? 0 replies

5 decimal places in MT4? 5 secs timeframe in MT4 6 replies

Need 4 decimal to 2 decimal EA change 0 replies

5 decimal places 11 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

4 decimal places in all cases

  • Post #1
  • Quote
  • First Post: Sep 1, 2020 7:56am Sep 1, 2020 7:56am
  •  appletrader
  • | Joined Oct 2014 | Status: Member | 95 Posts
Hello,

Not sure if this is the right area but i'm writing code in mql5 and trying to get 4 decimal places for a variable but i must be doing something wrong. Not sure if anyone can help?


//numA is a number like 78.244424242
double numA = NormalizeDouble(m_LastSwingPoints[3].swingValue, Digits() - 1);
double numAshort = NormalizeDouble(numA,4);

I'm trying to get the output to be 4 decimal places 78.2444 when i print numAshort
  • Post #2
  • Quote
  • Sep 1, 2020 8:33am Sep 1, 2020 8:33am
  •  Nicholishen
  • Joined Jul 2005 | Status: zzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzz | 1,289 Posts
Quoting appletrader
Disliked
when i print numAshort
Ignored
When you print you need to use DoubleToString and specify the number of decimal places as well.
 
1
  • Post #3
  • Quote
  • Sep 1, 2020 9:17am Sep 1, 2020 9:17am
  •  appletrader
  • | Joined Oct 2014 | Status: Member | 95 Posts
Thanks that did the trick
 
 
  • Post #4
  • Quote
  • Last Post: Jan 16, 2021 11:48pm Jan 16, 2021 11:48pm
  •  Macd-rsi
  • Joined Oct 2019 | Status: Forexian Fighter = FF | 9,183 Posts
Quoting appletrader
Disliked
Hello, Not sure if this is the right area but i'm writing code in mql5 and trying to get 4 decimal places for a variable but i must be doing something wrong. Not sure if anyone can help? //numA is a number like 78.244424242 double numA = NormalizeDouble(m_LastSwingPoints[3].swingValue, Digits() - 1); double numAshort = NormalizeDouble(numA,4); I'm trying to get the output to be 4 decimal places 78.2444 when i print numAshort
Ignored
even for internal operations, you had bettr to use double(DoubleToString ())
Be yourself
 
1
  • Platform Tech
  • /
  • 4 decimal places in all cases
  • Reply to Thread
0 traders viewing now
Top of Page
Forex Factory Blog Updated: Alerting All Members
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022