| New signals service! | |
|
|||||||
| 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 |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
|
|||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |