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

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Is it Possible to Make Money in Forex Market 165 replies

Is this possible with metatrader? 7 replies

Is this possible? 0 replies

Possible alternative to non-server based trailing stops 9 replies

is there any possible or not 0 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

is it possible?

  • Post #1
  • Quote
  • First Post: Feb 16, 2009 7:18pm Feb 16, 2009 7:18pm
  •  pinchapip
  • | Membership Revoked | Joined Jun 2007 | 745 Posts
Hi guys!!

I'm trying to code an indicator, but every time it deducts the day's high from the lows it spits the result out in 4 digits. I'm wondering if there is some sort of work around it so it will approximate the 4th digit, so that it will have a 3 digit final string.

For example; 1.29795 - 1.28067= 1728 what I'm looking for is a way to have it approximated to 173, so from 4 digits to 3 digits

Thanks !!!!!!!
For he that would be deceived, let him.
  • Post #2
  • Quote
  • Feb 16, 2009 7:20pm Feb 16, 2009 7:20pm
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
normalizedouble
 
 
  • Post #3
  • Quote
  • Feb 16, 2009 9:23pm Feb 16, 2009 9:23pm
  •  lohikeitto
  • | Joined Nov 2008 | Status: Member | 41 Posts
Hi pinchapip,

Here is a solution I always use.

PHP Code:
int DQ_ADJUST []  = { 0 , 0 , 1 , 10 , 1 , 10 , 100 };
int DQADJ;

//+------------------------------------------------------------------+
//| init
//+------------------------------------------------------------------+
int init()
{
   
DQADJ = DQ_ADJUST [ Digits ];
   return(
0);
}

//+------------------------------------------------------------------+
//| start
//+------------------------------------------------------------------+
int start()
{
   
// Returns usual pips base value regardless of the number of digits

   // example 1
   
double dVal = ((1.29795 - 1.28067)/Point)/DQADJ;
   
int Val = dVal; // = 173
   
   // example 2
   
double dVal = ((129.795 - 128.067)/Point)/DQADJ;
   
int Val = dVal; // = 173

   // example 3 --- DQADJ (deci-quotes adjustment) can be used like this also.
   
double Stoploss = Ask - SL*DQADJ*Point;
   
   .........

   return(
0);
} 
 
 
  • Post #4
  • Quote
  • Last Post: Feb 17, 2009 3:02am Feb 17, 2009 3:02am
  •  pinchapip
  • | Membership Revoked | Joined Jun 2007 | 745 Posts
Perfect!!!!! THANKS GUYS !!!!!!!!!
For he that would be deceived, let him.
 
 
  • Platform Tech
  • /
  • is it possible?
  • 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