Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 3
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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 Thread Tools Display Modes
  #1 (permalink)  
Old 02-01-2006, 02:08 PM
Nicholishen's Avatar
Nicholishen Nicholishen is offline
Senior Member
 
Join Date: Dec 2005
Posts: 531
Nicholishen is on a distinguished road
MT3 Questions

I recently realized that broker (particularly interbank fx) spreads can diverge more than 10 pips. I am scalping using MT3, and I attempted to code an algorithm to stay out of the market in such times. As the code is fairly simple, i seem to have problems with the following:

Code:
define: spread(2);

tt= spread * Point;
spr =ask - bid;

if spr != tt then 
	{
	sd++;
	 
	Print ("SPREAD DIFF ", spr);
	FileWrite(h1,bid,ask,spread,TimeToStr(CurTime),sd);
	}
	
Comment("BID (",bid,")    Ask (",ask,")   Spread (",spr,")");
When the result of spr is .0002 and tt = .0002 the expression for some reason still results as true. Any ideas to why?

Last edited by Nicholishen : 02-01-2006 at 02:13 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-01-2006, 03:10 PM
4xCoder 4xCoder is offline
Member
 
Join Date: Nov 2005
Posts: 49
4xCoder is on a distinguished road
You may be running into a floating point issue. I haven't wriiten MT3 in a long time but try something like below to see if it fixes the problem.

tt= spread ;
spr =(ask - bid)/Point;

if Abs(spr-tt) < .5 then
end
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic questions ... cardio Questions 58 06-27-2008 03:51 PM
Questions on simple EA dwmcqueen Metatrader 4 1 01-04-2007 01:55 PM
2 questions on codergurus course hayseed Setup Questions 3 12-07-2006 10:56 PM
Beginner questions. Thanks Locutus General Discussion 2 10-11-2006 07:26 PM


All times are GMT. The time now is 09:08 AM.