Forex



Go Back   Forex Trading > Downloads > Indicators - Metatrader 4
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 04-02-2007, 09:08 AM
Junior Member
 
Join Date: Oct 2006
Posts: 6
Boogie is on a distinguished road
Where is the bug in ReadFromFile

I try to use ReadFromFile but it does not work and I do not know why

I placed file week.txt in..

\experts\files\week.txt and it contains..

2007.03.30;15:00;Koko;USA;March;-0.5%;-0.8%;

and readFromFile placed in ..

\experts\indicators\readfromfile.mq4

which looks like this... and nothing happend

//+------------------------------------------------------------------+
//| ReadFromFile.mq4 |
//| ·•°njel°•· |
//| iamnotlinked |
//+------------------------------------------------------------------+
#property copyright "·•°njel°•·"
#property link "iamnotlinked"
#property show_inputs

extern bool DisplayText = true;

extern bool Japan = true;
extern bool USA = true;
extern bool Germany = true;
extern bool ES = true;
extern bool GB = true;
extern bool Canada = true;

extern string FileName = "week.txt";



int start()
{

ObjectsDeleteAll();

int handle;
handle=FileOpen(FileName,FILE_CSV|FILE_READ,';');
if(handle<1)
{
Print("File not found, the last error is ", GetLastError());
return(false);
}


int i= 0;

while(!FileIsEnding(handle))
{
string sDate=FileReadString(handle); // Date
string sTime=FileReadString(handle); // Time
string sDescription=FileReadString(handle); // Description
string sCountry=FileReadString(handle); // Country
string sPeriod=FileReadString(handle); // Period
string sCurrent=FileReadString(handle); // Current value
string sForecast=FileReadString(handle); // Expected
FileReadString(handle); // null

i++;
datetime dt = StrToTime(sDate+" "+sTime);

color c = Red;

if (sCountry == "Japan") c = Yellow;
if (sCountry == "USA") c = White;
if (sCountry == "Germany") c = Green;
if (sCountry == "ES") c = Blue;
if (sCountry == "GB") c = Orange;
if (sCountry == "Canada") c = Gray;


if ((sCountry == "Japan") && (!Japan)) continue;
if ((sCountry == "USA") && (!USA)) continue;
if ((sCountry == "Germany") && (!Germany)) continue;
if ((sCountry == "ES") && (!ES)) continue;
if ((sCountry == "GB") && (!GB)) continue;
if ((sCountry == "Canada") && (!Canada)) continue;


if (DisplayText)
{
ObjectCreate("x"+i, OBJ_TEXT, 0, dt, Close[0]);
ObjectSet("x"+i, OBJPROP_COLOR, c);
ObjectSetText("x"+i, sDescription + " "+ sCountry + " " + sPeriod + " " + sCurrent + " " + sForecast, 8);
ObjectSet("x"+i, OBJPROP_ANGLE, 90);
}


ObjectCreate("y"+i, OBJ_VLINE, 0, dt, Close[0]);
ObjectSet("y"+i, OBJPROP_COLOR, c);
ObjectSet("y"+i, OBJPROP_STYLE, STYLE_DOT);
ObjectSet("y"+i, OBJPROP_BACK, true);
ObjectSetText("y"+i, sDescription + " "+ sCountry + " " + sPeriod + " " + sCurrent + " " + sForecast, 8);

}

return(0);
}
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 04-02-2007, 09:14 AM
igorad's Avatar
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 963
igorad is on a distinguished road
You should use this code as a script.
__________________
Let's improve trade skills together
http://finance.groups.yahoo.com/group/TrendLaboratory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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


All times are GMT. The time now is 01:02 AM.



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