Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


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 06-19-2007, 07:33 PM
Member
 
Join Date: Apr 2006
Posts: 36
DollarShort is on a distinguished road
A coding guru will laugh at this, but....

I'm trying to modify TickLoggerForFXT.mq4 by Paul Hampton-Smith, but this doesn't ever go into my main loop. I've got EA's enabled and Allow Live Trading set on MT4.

The comment Past File Seek shows up on the chart (and stays there...) and the file has Date,Time,Open,High,Low,Close, (but no data) and
the Starting Main Loop comment never shows on the chart.

So.... why is this not going into the main loop?

Thank you for the help

Dollarshort


extern double Range = 0.10;
int handle;
int nTickCount;
datetime CurrTime, LastTime;
double LastBid, HighBid, LowBid, OpenBid, CloseBid;
double CloseBarHigh, CloseBarLow;
bool go = true;
int init()
{
Comment("Waiting for tick 062007_01");
handle = FileOpen(Symbol() +"RangeBar.csv", FILE_CSV|FILE_READ|FILE_WRITE, ',' );
FileSeek(handle,0,SEEK_END);
Comment("Past File Seek.");
FileWrite(handle,"Date,Time,Open,High,Low,Close");
}

int deinit()
{
FileClose(handle);
}

int start()
{
Comment("Starting Main Loop.");
CurrTime=TimeCurrent();
LastTime=TimeCurrent();
LastBid = Bid;
OpenBid = Bid;
CloseBid = Bid;
LowBid = Bid;
HighBid = Bid;
CloseBarHigh = LowBid + Range;
CloseBarLow= HighBid - Range;


Comment("Going into While loop.");
while(go)
{
Comment("In While Loop.");
if (CurrTime != TimeCurrent())
{
Comment("In If Statement.");
CurrTime = TimeCurrent();
nTickCount++;
if(Bid < LowBid ) LowBid = Bid;
if(Bid > HighBid) HighBid = Bid;
CloseBarHigh = LowBid + Range;
CloseBarLow= HighBid - Range;

Comment("\nLogging tick #",nTickCount);
FileWrite(handle,TimeToStr(CurTime(),TIME_DATE),Ti meToStr(CurTime(),TIME_SECONDS),DoubleToStr(OpenBi d,2),DoubleToStr(HighBid,2),
DoubleToStr(LowBid,2),DoubleToStr(CloseBid,2));
}
Comment("Out of If Statement.");
FileFlush(handle);
}
Comment("Out of While Statement.");
return(0);
}

Last edited by DollarShort; 06-19-2007 at 07:36 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-19-2007, 08:13 PM
mladen's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
mladen is on a distinguished road
Try this

The file in the attachment works

Last edited by mladen; 07-21-2008 at 04:35 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-20-2007, 12:14 AM
Member
 
Join Date: Apr 2006
Posts: 36
DollarShort is on a distinguished road
Mladen,

Thanky you for the help. Looking at the style of the code now, I guess that I should have run it through MT4's EA wizard. Also I notice that the comments are missing, so I'll look and see if EAs can have comments....

If you ran this I'm sure you noticed that the logic is still flawed, but at least now I can see what is wrong (almost everything) and go from there...

Thanks again!

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

Bookmarks

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advice EA-Stoc Guru :) odbc Expert Advisors - Metatrader 4 44 02-20-2007 01:32 PM
EMA CROSS upgrade...coders guru please help Aaragorn Suggestions for Trading Systems 25 06-22-2006 05:49 PM
Coders Guru Please Help Us sisi Metatrader 4 1 06-08-2006 01:10 PM
Another Request for Coders' Guru Maji Indicators - Metatrader 4 2 04-25-2006 05:26 PM
Need help with coding an EA eric79 Metatrader 4 24 01-18-2006 12:11 PM


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



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