Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (1) Thread Tools Display Modes
  #541 (permalink)  
Old 12-10-2007, 08:42 PM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by FXTradepro View Post
Thanks for the response - I am not a coder so this is a bit foreign to me. I did try Point*10 and that made the spread reading 410 pips. I also tried Point/10 and that made the spread reading 4.0 pips which appears to be "rounding" off the actual number which should have been 4.1 pips.

I do have a script for sending orders that I had to modify using Point*10, but I cannot seem to get this spread reading correct.

I think this is going to become an issue for many Indicators, Scripts and EA's, as I have heard that many MT4 Brokers might be adopting the fractional pip concept on their platforms.

Any other advice would be appreciated.

Dan
No worries. As I understand it, the term "pips" has grown a definition relating to trade size, meaning that a 1 pip move of a 1 lot trade corresponds to a known value amount. The term "Point" in MT4 more strictly means the granularity of price movement, i.e. the smallest difference there can be between two prices; or that every Bid/Ask price is some integer N times Point.

So far there has been a 1-1 translation between pips and Point in MT4, but that's no longer the case. Instead, for your broker, you have 1 pip = 10 Point, and therefore, if you want the "spread" variable to be in pips you will have to use the expression "(Point*10)" wherever you previously used "Point". The expression is without the double-quotes, but *with* the parentheses.

To make it very clear in the code, you could also add a function to provide the appropriate pips measure:
PHP Code:
double pips() { return ( Point 10.0 ); } 
and in that case, you would replace "Point" at all other places with the function call "pips()".

Alternatively, you let the program work with the Point granularity, and merely translate to pips when the spread value is presented. I.e. forget about using the pips() function above, but have the following function for translating a Points value to be a pips value:
PHP Code:
double pips(int points) { return ( 1.0 points 10.0 ); } 
Then the spread value component in the ObjectSetText call would be like:
PHP Code:
DoubleToStrpipsSpread ), 

Last edited by ralph.ronnquist; 12-10-2007 at 08:44 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #542 (permalink)  
Old 12-11-2007, 01:44 AM
Senior Member
 
Join Date: Mar 2006
Location: La Verne,CA
Posts: 552
MrPip is on a distinguished road
Problem with Point

I now use the following code and replace all occurances of Point with myPoint.

First I declare a global variable

double myPoint;

I then add the following line in Init function.

myPoint = SetPoint();

Then add the function

double SetPoint()
{
double mPoint;

if (Digits < 4)
mPoint = 0.01;
else
mPoint = 0.0001;

return(mPoint);
}

This works whether the broker uses fractional pips or not.


Robert
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #543 (permalink)  
Old 12-11-2007, 07:16 AM
Junior Member
 
Join Date: Jul 2007
Posts: 19
PANNEK is on a distinguished road
Please Help Me

can you any body help me?
I want expert 20_200 with trailing stop.
PLEASE put anybody.
Attached Files
File Type: mq4 20_200 expert_v3.mq4 (5.0 KB, 11 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #544 (permalink)  
Old 12-11-2007, 09:35 AM
Junior Member
 
Join Date: Jul 2007
Posts: 19
PANNEK is on a distinguished road
please

Quote:
Originally Posted by PANNEK View Post
can you any body help me?
I want expert 20_200 with trailing stop.
PLEASE put anybody.
little help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #545 (permalink)  
Old 12-11-2007, 09:37 AM
Senior Member
 
Join Date: Feb 2006
Posts: 524
Michel is on a distinguished road
Quote:
Originally Posted by MrPip View Post
I now use the following code and replace all occurances of Point with myPoint.

First I declare a global variable

double myPoint;

I then add the following line in Init function.

myPoint = SetPoint();

Then add the function

double SetPoint()
{
double mPoint;

if (Digits < 4)
mPoint = 0.01;
else
mPoint = 0.0001;

return(mPoint);
}

This works whether the broker uses fractional pips or not.


Robert
You do not really need a function, it's enough to put in the init() function:
PHP Code:
myPoint 0.0001;
if (
Digits 4myPoint 0.01
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #546 (permalink)  
Old 12-11-2007, 10:17 AM
Junior Member
 
Join Date: Jul 2007
Posts: 19
PANNEK is on a distinguished road
Newdigital

Quote:
Originally Posted by PANNEK View Post
can you any body help me?
I want expert 20_200 with trailing stop.
PLEASE put anybody.
please help NEWDIGITAL
Attached Files
File Type: mq4 20_200 expert_v3.mq4 (5.0 KB, 6 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #547 (permalink)  
Old 12-11-2007, 11:20 AM
Senior Member
 
Join Date: Mar 2006
Location: La Verne,CA
Posts: 552
MrPip is on a distinguished road
Quote:
Originally Posted by Michel View Post
You do not really need a function, it's enough to put in the init() function:
PHP Code:
myPoint 0.0001;
if (
Digits 4myPoint 0.01
I would do it your way if I only had a few EAs to worry about. I actually have this code in a library along with numerous other functions that use myPoint instead of Point in the code. That way I only need to change code in one place and recompile all EAs. Just in case some broker decides to add another decimal place.

Robert
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #548 (permalink)  
Old 12-11-2007, 11:23 AM
Senior Member
 
Join Date: Mar 2006
Location: La Verne,CA
Posts: 552
MrPip is on a distinguished road
trailing stop needed

Quote:
Originally Posted by PANNEK View Post
can you any body help me?
I want expert 20_200 with trailing stop.
PLEASE put anybody.
What type of trailing stop?
I have over 10 types now.

Robert
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #549 (permalink)  
Old 12-11-2007, 03:25 PM
Junior Member
 
Join Date: Jul 2007
Posts: 19
PANNEK is on a distinguished road
Triling Stop

Quote:
Originally Posted by MrPip View Post
What type of trailing stop?
I have over 10 types now.

Robert
Sorry, I don't know exactly, but
I thing is good like this ea. EA_TrendStrengthEMAv2
Attached Files
File Type: mq4 EA_TrendStrengthEMAv2.mq4 (6.7 KB, 11 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #550 (permalink)  
Old 12-12-2007, 02:16 AM
Member
 
Join Date: Jul 2007
Posts: 61
Ghamm is on a distinguished road
Today Yesterday Now functions..

I want to get a date range.

Yesterday at 5 PM to 3:00 AM today... then want to look at the bars between that range.

I dont see a function to get the beginning of the day (seconds from 1970)
I can do the math myself, by using modulus etc. but wondering if there any easy mt4 functions Im not seeing to do this..
There must be an easy way in MT4.


Craig
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
CHinGsMAroonCLK, I_XO_A_H

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
Posted By For Type Date
Need an experienced programmer? - Page 2 Post #0 Refback 09-24-2008 06:24 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 04:22 PM


All times are GMT. The time now is 06:45 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.