Visibility is very important for this site. If you like it please link to this URL or use our online form to add your reciprocal link. Learn more about reciprocal links

Home


Standart library for MT4 experts

Introduction

This article requires some knowlege of MQL scripting language. As tutorials are available at MT4 home page, I am not going to explain basics of the language here.

Instead, we are going to create an expert for MT4, making sure all little pitfalls are avoided. Also, as part of the code we are about to create is the same for all experts, we are going to move it to a separate library file, this way, if we need to edit this code, we will only have to do it in one place, instead of making the (error-prone) changes to every expert we have.

This article is about the abovementioned library file, for an example of an expert using this library, see the next article.

How it is supposed to work?

As the library we are working on is designed to be part of an expert (MTS, capable of trading without human interference), let's discuss problems, that improperly written experts may have, as well as ways to resolve them.

An expert contains 3 functions, init(), start() and deinit(), first is called after the expert is used for the first time (duting the current session), the last one is called before the expert is removed (MT4 is closed, chart containing the expert is closed, or an expert is removed from the chart. As for the start(), it is called every tick.

This is the first, and the most important of possible pitfalls, as we want our expert to work the same way during the testing and in the run time. But there are no ticks during the testing! Of course, MT4 TRIES to emulate the most probable prices, using available OHLC (Open-High-Low-Close) data, but still...

Also, if an expert is a complex one, or if we have many charts, with experts attached to them, the computer slows down.

The most common solution is to trade "at the end of the bar". It means, that we use a piece of code, located at the beginning of the start() function, to figure out, if this tick is the first tick of a new bar, and only if it is so, we run the rest of the "start", otherwise we simply stop, until the next tick.

The second thing to keep in mind is that simple fact, that at the beginning of a new bar we DO NOT know it's High, Low and Close - we only have Open. This pitfall we have already discussed in the previous article, but as this is the "favorite" beginner's error, let me repeat: the code below is incorrect:

double x = Close[0];

If you want your expert to run every tick, it is OK. In this case, the Close[0] means not "the bar's close", but simply "the last value". Same, as the High[0] simply means "the highest value since the bar's beginning, so far". Note, it is "so far", not "till theend of the bar".

As soon as you try to do testing, using historical data, the Close[0] will create a problem. Because MT4 "knows" what Close[0] is, for all the historical data. The testing will go fine, but the result will not be applicable to real time trading, as in real time trading we never know what High, Low, Close[0] are!

In our expert, we are going to use High[1], Low[1], Close[1], to make sure our trading system does not "look into the future". Open[0] is fine.

The thirt important thing is related to the fact, that, regardless the multitasking nature of MT4, you can not perform two trades simultaneously. As the mater of fact, you need to make sure one trade is complete, and only then to proceed with the second one.

This is not a big deal, if you only have one expert - a "normal" expert will not try to do few trades in a time anyway. Usually, it means, that your testing will go fine, and then, when you try to run your expert on your demo account, it will "compete" with other experts (provided you have more than one expert running) for the right to open/close/modify positions. As the result, one of the two trades will not be executed.

There is a "cure" for this "deadlock", of course. All you need, is to make sure your experts trade one after another, and never - simultaneously. To do it, we are going to use "magic numbers".

Magic number is an integer, associated with the order. We are going to extend it a little bit. For our experts, the magic number will uniquely identify a combination of an expert (expert name), a currency (say, EURUSD) and a time frame (say, H1). For example:

AnchoredMomentum:
	EURJPY_H1: 	1
	GBPUSD_H1: 	2
			
Channel:
	EURUSD_H1: 	3
	EURJPY_H1: 	4
	USDCHF_H1: 	5
	GBPUSD_H1: 	6
	GBPJPY_H1: 	7
	USDJPY_H1: 	8
	EURGBP_H1: 	9
...

The first thing our expert will do, when the start() is called, is checking the global variable ("global" variables are "visible" to all experts, so experts can use them to exchange the information). If this variable is 0, an expert assigns its unique magic number to it (this approach is called "semaphores"). From this point on, all the experts "know", that they can NOT trade - until our expert releases the semaphore. To release it, at the very end of its start() function, it should assign 0 to it.

Technically speaking, this approach should work, but we are going to add an extra level of "protection against competition between experts". We are going to assign them TIME when they are allowed to trade. Once again, it is just an extra precaution.

Let's say, our experts are fast and robust. To run, their start() function need only 1-2 seconds. Then, if we start the first expert (one with magic number equal one) at the beginning of the bar, the second at the beginning of the bar PLUS 10 seconds, the third - at the beginning of the bar PLUS 20 seconds and so on, they (most of the time) will not even try to compete for order execution.

The library

This is just a code to be included in all experts. We do not want to retype it every time, so we keep it separately. According to the coding standarts, it should be located in MT4's experts/include directory, but I prefer to have access to it from the list of experts, so I placed it to experts directory.

Note, that in addition to "trading" functions, this code also contains some "reporting" functions. They are usefull when you test your expert, trying to figure out, why is it not working.

Note also, that we use some variables here, that should be assigned values in the expert, for example, dStopLoss, dTakeProfit... It is convenient, of course, but in the same time, you need to remember, to use these names. For example, you can not use "take_profit" instead of "dTakeProfit" in your expert.


// Value of the take profit, on a chart:
// dTp = Bid - dTakeProfit; 
// or 
// dTp = Ask + dTakeProfit;

double dTp = 0;

// Used to deside, if this is the beginning of a new bar.

int nBars;

// An expert runs 10 * nMagic seconds after the bar end
// This way we reduce competition between experts and
// avoid deadlocks

int nDelaySeconds = 10;

// Slippage

int nSlip = 5;

// Used to calculate the size of a lot, if bUseMm is
// set to 0, the lot size is always 0.1
// We strongly recommend that you use your own 
// money management system, this is just a simple 
// placeholder

double dProfit = 0;

// Used to figure out if we have enough money to trade
// We strongly recommend that you use your own 
// money management system, this is just a simple 
// placeholder

double dInitAmount = 1000;

// A standart lot size

double dLotSize = 0.1;

// Magic number. Unique for a combination of expert -
// currency - timeframe

int nMagic = 0;

// Report is not part of the trading, but only a 
// function to write transactions to a file. We 
// do it once a day

bool bReportDone = false;

// This variable contains 0, or the magic number 
// of currently trading expert

string strTradeSemaphore = "TradeSemaphore";

// ------

/* This function creates a file with the name, 
that is unique for an expert-currency-timeframe, 
and writes trading history in it.

Note, that we only same the profit of operation(s) 
here. If you want to save additional information, 
like order open dates or swaps, you need to modify 
the code below.

The strFileName contains the file name prefix, 
usually it is the name of an expert.
*/

void Report(string strFileName, int nMagic, 
	bool& bReportDone)
{
	// Do it only during run time trading
	if(IsTesting())
		return;

	// Save once a day, at 0 hours nMagic / 2 minutes
	if(Hour() == 0 && Minute() >= nMagic / 2)
	{
		// Make sure it only happens once, even 
		// if we have 2 or more ticks satisfying 
		// the condition above

		if(bReportDone == false)
		{
			int hFile = FileOpen(strFileName + "_" 
				+ Symbol() + "_" + Period() + ".rpt", 
				FILE_BIN | FILE_WRITE, ',');
			
			string str = "CloseDateTime,Buy,Sell\r\n";
			FileWriteString(hFile, str, StringLen(str)); 

			// Write the entire trading history to the 
			// file. 
			// Note: make sure all trading history is 
			// available (MT4-Terminal-Account History)
			
			for(int nCnt = 0; nCnt < HistoryTotal(); 
				nCnt++)
			{
				OrderSelect(nCnt, SELECT_BY_POS, 
					MODE_HISTORY);	
				if(OrderMagicNumber() == nMagic && 
					OrderType() <= OP_SELL && 
					OrderSymbol() == Symbol())
				{
					str = TimeToStr(OrderCloseTime(), 
						TIME_DATE|TIME_MINUTES);
					
					if(OrderType() == OP_BUY)
						str = str + "," + OrderProfit() 
							+ ",0";
					else
						str = str + ",0," + OrderProfit();
					
					str = str + "\r\n";
					
					FileWriteString(hFile, str, 
						StringLen(str));
				}
			}			

			FileFlush(hFile); 
			FileClose(hFile); 
			
			bReportDone = true;
		}
	}
	else if(Hour() != 0)	// Reset the flag
		bReportDone = false;
}

// ------

// A simple placeholder for a real money management
// algorythm. In expert, set bUseMm to false or
// true. A default lot size is 0.1.

double GetLotSize(double dInitFraction = 0.1, 
	double dProfitFraction = 0.1)
{
	double dLot = 0.1;
	
	if(bUseMm)
	{
		dLot  = (dInitFraction * dInitAmount + 
			dProfitFraction * dProfit) / 1000;

		dLot = MathFloor(dLot * 10) / 10;
	
		if(dLot < 0.1)
			dLot = 0.1;
	}
	
	return(dLot);
}

// ------

/* Buy() and Sell() functions use dStopLoss and 
	dTakeProfit, that are assigned in the expert.

We are going to try to open an order for 10 times, 
	because sometimes the server or the Internet 
	connection fails.

Note the call to SaveComment() function. If the 
	order was not opened, when you think it should 
	be, you may check the corresponding file in 
	experts/files directory. It will give you the 
	error number and some additional hints on what 
	happened.

Note, that it is possible to use more than one 
	magic number with the same 
	expert-currency-timeframe, in which case
	you need to explicitely pass it as a 
	nMagicNumber parameter.

dLot is a coefficient (a multiplier) used to 
	increase the lot size, usually, you will use 
	it for trading contests, or if you are 
	overconfident in the performance (drawdowns) 
	of your expert.
*/

int Sell(string strExpertName, double dLot = 0, 
	int nMagicNumber = -1)
{
	int nResult = -1;
	
	if(nMagicNumber == -1)
		nMagicNumber = nMagic;

	if(dLot == 0)
		dLotSize = GetLotSize();
	else
		dLotSize = dLot * GetLotSize();
	
	// Note, that this is a simple placeholder for a 
	// real money management algorythm. We will discuss
	// money management in a separate article.
	if(AccountFreeMargin() < dLotSize * dInitAmount 
		|| AccountFreeMargin() < 500)
		return(nResult);

	double dTp;
	if(dTakeProfit == 0)
		dTp = 0;
	else
		dTp = Bid - dTakeProfit;

	// We try 10 times
	for(int nTry = 0; nTry < 10; nTry++)
	{
		SaveComment("\r\n" + Day() + "." + Month() + 
			"." + Year() + " " + Hour() + ":" + 
			Minute() + ":" + Seconds());
		SaveComment(" Trying to sell, attempt " + 
			nTry + "\r\n");
		SaveComment("\r\nAsk: " + Ask + ", StopLoss: " + 
			dStopLoss + ", TakeProfit: " + dTakeProfit 
			+ "\r\n");
		
		nResult = OrderSend(Symbol(), OP_SELL, dLotSize, Bid, 
			nSlip, Bid + dStopLoss, dTp, strExpertName, 
			nMagicNumber, 0, OrangeRed);
		
		// Wait 10 seconds before the next try.
		Sleep(10000);

		// If trade failed, refresh rates and try again
		if(nResult != -1)
		{
			SaveComment(" successfull\r\n");
			break;
		}
		else
		{
			SaveComment(" failed, error " + GetLastError() 
				+ "\r\n");
			RefreshRates();
		}
	}	
	
	// If all 10 attempts failed, write additional info
	// to the report file
	if(nResult == -1)
	{
		int nError = GetLastError();
		Alert(strExpertName + " sell error: " + nError 
			+ "\r\n" + Bid + ", " + dStopLoss + ", " 
			+ dTp);
		SaveComment(strExpertName + " sell error: " + 
			nError + "\r\n" + Bid + ", " + dStopLoss + 
			", " + dTp);
	}
	
	return(nResult);
}

// ------

// The structure of Buy() is similar to Sell(), 
// see Sell() for comments

int Buy(string strExpertName, double dLot = 0, 
	int nMagicNumber = -1)
{
	int nResult = -1;
	
	if(nMagicNumber == -1)
		nMagicNumber = nMagic;

	if(dLot == 0)
		dLotSize = GetLotSize();
	else
		dLotSize = dLot * GetLotSize();
	
	if(AccountFreeMargin() < dLotSize * dInitAmount 
		|| AccountFreeMargin() < 500)
		return(nResult);

	double dTp;
	if(dTakeProfit == 0)
		dTp = 0;
	else
		dTp = Ask + dTakeProfit;

	for(int nTry = 0; nTry < 10; nTry++)
	{
		SaveComment("\r\n" + Day() + "." + Month() + 
			"." + Year() + " " + Hour() + ":" + Minute() + 
			":" + Seconds());
		SaveComment(" Trying to buy, attempt " + nTry + 
			"\r\n");
		SaveComment("\r\nBid: " + Bid + ", StopLoss: " + 
			dStopLoss + ", TakeProfit: " + dTakeProfit);
		
		nResult = OrderSend(Symbol(), OP_BUY, dLotSize, Ask, 
			nSlip, Ask - dStopLoss, dTp, strExpertName, 
			nMagicNumber, 0, Aqua);

		Sleep(10000);
		if(nResult != -1)
		{
			SaveComment(" successfull\r\n");
			break;
		}
		else
		{
			SaveComment(" failed, error " + GetLastError() + 
				"\r\n");
			RefreshRates();
		}
	}	

	if(nResult == -1)
	{
		int nError = GetLastError();
		Alert(strExpertName + " buy error: " + 
			nError + "\r\n" + Ask + ", " + dStopLoss + 
			", " + dTp);

		SaveComment(strExpertName + " buy error: " + 
			nError + "\r\n" + Ask + ", " + dStopLoss + 
			", " + dTp);
	}

	return(nResult);
}

// ------

/* We use this function to modify orders. It uses 
	dTrailingStop, assigned in the expert. When the 
	price goes away from the stop loss more than 5
	points (from the stop loss to stop loss + 5 points), 
	we move the stop closer to the price.
*/

void ModifyOrders()
{
	if(dTrailingStop == 0)
		return;

	// Scan all opened orders, looking for an 
	// order with "our" magic number

	for(int nCnt = 0; nCnt < OrdersTotal(); 
		nCnt++)
	{
		OrderSelect(nCnt, SELECT_BY_POS, 
			MODE_TRADES);
		if(OrderMagicNumber() == nMagic)
		{
			if(OrderType() == OP_BUY)
			{
				if(OrderStopLoss() < Bid - 
					dTrailingStop - 5 * Point)
				{
					OrderModify(OrderTicket(), 
						OrderOpenPrice(), 
						Bid - dTrailingStop, 
						OrderTakeProfit(), 
						0, Aqua);

					// Note: we assume, that there 
					// is only one opened order with 
					// this magic number in a time. 
					// If it is not so, comment the 
					// "break".
					break;
				}
			}
			
			if(OrderType() == OP_SELL)
			{
				if(OrderStopLoss() > Ask + 
					dTrailingStop + 5 * Point)
				{
					OrderModify(OrderTicket(), 
						OrderOpenPrice(), 
						Ask + dTrailingStop, 
						OrderTakeProfit(), 
						0, OrangeRed);

					break;
				}
			}
		}
	}
}

// ------

// This function determines if this is the beginning
// of a new bar. Note, that in order to avoid conflicts
// between experts, we wait few seconds after the bar
// start, the delay is unique for each expert-currency-
// timeframe

bool IsBarEnd()
{
	bool bIsBarEnd = false;
	if(nBars != Bars)
	{
		if(IsTesting() || (!IsTesting() && 
			CurTime() > Time[0] + nMagic * nDelaySeconds))
		{
			bIsBarEnd = true;
			nBars = Bars;
		}
	}
	
	return(bIsBarEnd);
}

// ------

/* The magic number of the currently trading expert 
	(or 0) is stored in the global variable. In a cycle,
	our expert tries to set its magic number to this global 
	variable, and when successfull, exits the cycle.
*/

void CheckTradeSemaphore()
{
	if(!IsTesting())
	{
		while(!IsStopped())
		{
			GlobalVariableSetOnCondition(
				strTradeSemaphore, nMagic, 
				0.0);

			if(GlobalVariableGet(strTradeSemaphore) 
				== nMagic)
				break;

			Sleep(1000);
		}
	
		RefreshRates();
	}
}

// ------

/* Attempts to close an order, for 10 times. 
	Comments written to the file with SaveComment()
	will help you to debug the expert, if it fails
	to close an order.
*/

void CloseBuy(string strExpertName)
{
	int nTicket = OrderTicket();
	SaveComment("\r\n\tAttempting to close long 
		position, ticket: " + nTicket + "\r\n");
	
	for(int nTry = 0; nTry < 10; nTry++)
	{
		SaveComment(Day() + "." + Month() + "." + 
			Year() + " " + Hour() + ":" + Minute() + 
			":" + Seconds());
		int nResult = OrderClose(OrderTicket(), 
			OrderLots(), Bid, nSlip, Aqua);
		
		Sleep(10000);
		if(nResult == -1)
		{
			int nError = GetLastError();
			Alert(strExpertName + ", error: " + nError);
			SaveComment(strExpertName + ", error: " + nError);
		}
		
		bool bClosed = true;
		for(int nOrderNo = OrdersTotal() - 1; 
			nOrderNo >= 0; nOrderNo--)
		{
			OrderSelect(nOrderNo, SELECT_BY_POS, MODE_TRADES);
			if(OrderTicket() == nTicket)
			{
				bClosed = false;
				break;
			}
		}
		
		if(bClosed == true)
		{
			SaveComment(
				"\r\n\tNo more orders with this ticket No");
			break;
		}
		else
		{
			SaveComment("\r\n\tOrder with this ticket 
				still present, trying again");
			RefreshRates();
		}
	}
}

// ------

// Same logic as in CloseBuy()

void CloseSell(string strExpertName)
{
	int nTicket = OrderTicket();
	SaveComment("\r\n\tAttempting to close short position, 
		ticket: " + nTicket + "\r\n");
	
	for(int nTry = 0; nTry < 10; nTry++)
	{
		SaveComment(Day() + "." + Month() + "." + Year() + 
			" " + Hour() + ":" + Minute() + ":" + Seconds());
		int nResult = OrderClose(OrderTicket(), 
			OrderLots(), Ask, nSlip, OrangeRed);
		
		Sleep(10000);
		if(nResult == -1)
		{
			int nError = GetLastError();
			Alert(strExpertName + ", error: " + nError);
			SaveComment(strExpertName + ", error: " + nError);
		}
		
		bool bClosed = true;
		for(int nOrderNo = OrdersTotal() - 1; 
			nOrderNo >= 0; nOrderNo--)
		{
			OrderSelect(nOrderNo, SELECT_BY_POS, MODE_TRADES);
			if(OrderTicket() == nTicket)
			{
				bClosed = false;
				break;
			}
		}
		
		if(bClosed == true)
		{
			SaveComment("\r\n\tNo more orders with 
				this ticket No");
			break;
		}
		else
		{
			SaveComment("\r\n\tOrder with this ticket still 
				present, trying again");
			RefreshRates();
		}
	}
}

// ------

// Open a file with unique file name, add a string
// to the end of this file

void SaveComment(string strComment)
{
	if(!IsTesting())
	{
		int hFile = FileOpen("__test_" + strExpert + 
			"_" + Symbol() + ".txt", 
			FILE_BIN | FILE_READ | FILE_WRITE, '\t');	
	
		FileSeek(hFile, 0, SEEK_END);
		FileWriteString(hFile, strComment, 
			StringLen(strComment));
	
		FileClose(hFile);
	}
}

// ------

// Delete pending order, logic is the same as in
// CloseBuy()

int DeletePending()
{
	int nResult = -1;
	
	for(int nTry = 0; nTry < 10; nTry++)
	{
		SaveComment("\r\n" + Day() + "." + Month() + 
			"." + Year() + " " + Hour() + ":" + 
			Minute() + ":" + Seconds());
		SaveComment(" Trying to delete pending " + 
			OrderTicket() + ", attempt " + nTry + "\r\n");
		
		nResult = OrderDelete(OrderTicket());
		
		Sleep(10000);
		if(nResult != -1)
		{
			SaveComment(" successfull\r\n");
			break;
		}
		else
			SaveComment(" failed, error " + 
				GetLastError() + "\r\n");
	}	
	
	if(nResult == -1)
	{
		int nError = GetLastError();
		Alert(strExpert + " delete pending, error: " 
			+ nError + "\r\n");
		SaveComment(strExpert + 
			" delete pending, error: " + nError + "\r\n");
	}
	
	return(nResult);
}

What is FOREX?
Choosing a platform for Forex trading
Creating an indicator for MT4
Standart library for MT4 experts
Creating an expert for MT4

Link to us and make 20% commissions through our affiliate program

Free Stock trading Course

The course consists of five E.mails and covers all essentials of Technical Analysis approach to Stock Trading. Compare to $$$ that you will have to pay elsewhere. All you need to do is to enter your name (nickname will do) and E.mail address in the form below.

Name: E-Mail:
Free intros:

State of Power Tutorial

Hypnosis Tutorial

NLP Tutorial

Working with the Future Tutorial

Hypnotic Inductions

Working with Money

Working with Habits

Manipulation Tutorial


Karate online tutorial

Chi Gun online tutorial

Tai Chi 24 forms online tutorial

Tai Chi 40 forms online tutorial

Tai Chi 108 forms online tutorial

Tai Chi Chi Gun 18 forms online tutorial

Chi Gun (Dao In) Heart and Blood Vessels 8 forms online 
tutorial

Chi Gun (Dao In) Kidneys 8 forms online tutorial

Joints Gymnastics, Chi Gun warm-up online tutorial

Chi Gun tao of Dr. Shi online tutorial


Sore back treatment

Headache Relief Pressure Points Tutorial


Stock trading - technical analysis

Making a small profitable web site

Neural Networks

Flow Charts and decision trees for web sites and 
presentations

Another powerfull Flow Charts Designer

Site Downloader

Thumbnails Generator

Calendar Creator

Touch Typing


Photo gallery


Jewelry: Pearl. How to choose, price estimation,
					take care, history, legends, classification Pearl. How to choose, price estimation, take care, history, 
legends, classification Artifficial Pearl. Links to: How to choose pearl, estimate price, 
take care, history, legends, classification Buying Pearl. Links to: How to choose, estimate price, take care, 
history, legends, classification Jewelry: Pearl. Taking care. Links to: How to choose, estimate 
price, history, legends, classification Jewelry: Classification of Pearl. Links to: How to choose, 
estimate price, take care, history, legends Jewelry: Cultivated Pearl. Links to: How to choose, estimate 
price, take care, history, legends, classification Jewelry: Pearl. History and legends. Links to: How to choose, 
estimate price, take care, classification Jewelry: Pearl. Price estimation. Links to: How to choose, take 
care, history, legends, classification Jewelry: Pearl. What is it? Links to: How to choose, estimate 
price, take care, history, legends, classification


NLP, Hypnosis, Power, Manipulation Tai Chi, Chi Gun Neural Networks
Joints Gymnastics Photo album generator
Habit Management Karate tutorial Flow charts for Presentations and Web

Sore back treatment Calendar Creator
Building a small profitable site
Another powerfull Flow Charts Designer
Profitable web site in 9 days Web programming : Perl, XML Site Downloader
Web positioning Shareware Directory


Touch Typing
Stock and FOREX Trading Stock Photo Gallery

Keywords:

review software stock trading
The Stock Downloader program allows you to automatically download free live stock quote files from the yahoo historical stock quote server.
Both historical intraday stock data and yahoo historical stock quote files can be downloaded.

day trading e book
A free e.mail trading course containing 5 e.mails with stock day trading tip information is available from this site. In this e.mails, the basics of computer system trading is covered.
The links in the left column can be used as a day trading tutorial, containing multiple day trading how to stock day trading tips for the technical investment analysis.

atr breakout
This article covers the Advanced True Range indicator. It includes the basic information, formulas and an example case study.

investing quote stock
This site offers tutorials for both day profit trading and day end trading.
Software available for downloading includes stock downloader for historical intraday data and yahoo historical stock quote files with day end quotes.

archive quote stock
The yahoo historical stock quote archives can be downloaded from the Internet automatically using the Stock Downloader software.

current quote stock yahoo
Yahoo server provides stock market quote historical data, available for downloading from the Internet as CSV (comma separated) files. These files are updated daily, after the markets close.
Yahoo server also provides 15 minutes delayed intraday quotes that can be downloaded by the Stock Downloader as they appear online.

commodity market system trading
The tutorials available from this site can be used for online day trading education.
The Trader trading simulator can produce trading signals based on the indicators. You can use indicators, that come with the program, or create your own using Trader's built-in scripting language.

stock trend chart
The Trader trading simulator is an example of chart pattern recognition software - it can detect price trends, plot them and use them to generate trading signals.

stock day trading tip
The trading course, available as five e.mails contains trading tips and well-known (but mostly ignored) common sence trading rules.

sp 500 trading system
To create your own indicators, for example, as part of sp 500 trading system, use Trader's built-in scripting language.

The language resembles the Basic, and gives you the access to many functions, such as convergence divergence test, chart pattern recognition, point figure charting and much more.

historical market quote stock
Use the Stock Downloader to download both intraday and day end stock quotes from the Yahoo stock server.
The program provides you with high degree of flexibility, it is designed in such way, that you can leave it unattended for extended periods of time (months).

history market quote stock
Historical quotes available from the yahoo historical stock quote server are adjusted for splits.
The split files are available together with the stock quotes. However, downloading them is a much more difficult task.
The Stock Downloader will take care of it for you.

free system trading
Use the Stock Downloader together with the Trader program, to download free stock quotes and produce trading signals.
On this site you will find tutorials about stock trading, that will help you to buils your own trading systems.

day profit trading
The day trading uses the last moment information, and decisions have to be made FAST. That's why we use computers to make automatic decisions.
To do a successfull day living trading, you will need to practice on some kind of sample data first. This data can be obtained using the Stock Downloader program.
Note, that the quotes on Yahoo server are 15 minutes delayed.

day living trading
Can the day trading be profitable for you, and not just for your broker?
Read our trading course to learn the common sence tips and tricks.

convergence divergence test
When two lines come closer, it is called convergence. When they go in the opposite directions (one up, one down) - it is a divergence.
The thing is - the convergence / divergence test usually works faster than the convergence divergence indicator itself, providing predictive signals.

historical intraday stock data
When you use the Stock Downloader to get the intraday data, you will be connected to the Yahoo server. The 15 minutes delayed data are extracted from the Yahoo pages, together with the split information, if any.

definition ppo
This article covers the Percenmtage Price Oscillator indicator. It includes the basic information, formulas and an example case study.

formula macd
MACD stands for the Moving Average Convergence Divergence.
As you can guess from the title, the moving averages are calculated for the stock price, and the points of their intersections are used as trading signals.

screen stochastic
Stochastic indicators are trying to determine the buying and selling pressure. If the security is under the pressure, then sooner or later the price will adjust.
Mostly, these are range indicators.

real time day trading signal
The stock quotes from the Yahoo stock server are 15 minutes delayed. You can take this fact into consideration whan creating your own trading system, or simply use the downloaded data to learn the technical investment analysis before doing "the real thing".

downloader stock
The Stock Downloader is a program that uses Yahoo stock server to download stock quotes.
It will also download split information.

chart pattern recognition software
The Trader day trading simulation program is an example of the chart pattern recognition software. It can find the beginning and end of the price trend, and to generate trading signals using the convergence and divergence of the trendlines.

wmt stock quote
One of the stocks used as an example in the Trader tutorials is the WMT.


free live stock quote

The Stock Downloader works as a front end for any software taht can use it's files. It creates the free live stock quote files on the disk, and as the new information becomes available, appends it to these files.


past stock quote
The Stock Downloader makes the past stock quote information available as it will download historical quote files from the Yahoo for you.
As there is no historical intraday data files at the yahoo finance stock quote server, the Stock Downloader queries Yahoo once a minute, saving the data to the historical file of its own.

computer system trading
There is a number of free educational files on this site, containing free information on creating the trading system using computer.

historical stock quote free
Historical stock quotes can be downloaded from the Yahoo using the Stock Downloader program. The downloading process is automated.

day trading simulation
The Trader day trading simulation program works with the indicators, providing you with the free charts, including point figure charting, trading signals and pattern analysis.

download historical quote
When we use the Stock Downloader to download historical quote files from the Yahoo site, we have to keep in mind, that this quotes are delayed. Normally, it is a 15 minutes delay for the intraday quotes, and up to few hours delay for the day end stocks (they update their data after the markets are closed, and it takes some time).

day trading pattern
Read the free online tutorials, available from our site, to learn about creating the indicators, using trading patterns.

stock index trading system
The index can be treated same way you treat the individual stock. You can buy it, sell it, download its quotes, and create the indicator, that takes full advantage of this particular index's behaviour.

yahoo finance stock quote
This service provides day end files, available for downloading. The Stock Downloader program can do it automatically for you.
Also, the intraday data can be extracted from some pages on the yahoo finance stock quote server. The Stock Downloader can do this for you, too.

simulator trading
The Trader day trading simulation program provides you with the power of technical analysis. It performs charting, applies the indicators to produce the trading signals, and even can analyze the chart patterns.
Also, you can use the predictive power of the neural networks, together with this program, as part of the custom indicators.

moving average trading system
The use of moving averages extends from the simple data smoothing, to the complex indicators, based on convergence, divergence and pattern analysis.
On one side, the moving average is always behind. On the other side, the derived indicators can sometimes "look forward", predicting the future values.

trading indicator
Indicators can be used to produce trading signals.

free intraday charts
Use the data, obtained using Stock Downloader program, to create free intraday charts

day trading simulator
We strongly advice, that you use some kind of the day trading simulator, before doing the "real thing", risking the real money.

intraday quotes
The Stock Downloader creates two files for each stock, one with the intraday quotes, and one with the split information.

technical analysis stock screen
Using the Trader's built-in scripting language, you can write your own stock screen. However, try the stock screens available online, first.

yahoo historical stock quote
This service provides day end files, available for downloading. The Stock Downloader program can do it automatically for you.
Also, the intraday data can be extracted from some pages on the yahoo finance stock quote server. The Stock Downloader can do this for you, too.

macd convergence divergence
This is one of the most commonly used trading indicators. It is simple, reasonably reliable and can be implemented using computers.

technical indicator macd
The difference between two moving averages is used to test for the buy and sell signals.

point figure charting
The "timeless" indicator, making possible to perform pattern analysis in a fast and elegant way.

technical analysis of stock trend
The Trader program has built-in functions for the trend analysis, particularly, it can check, if the trends for two lines (like MACD and price) go in the different directions.

day trading techniques
Read our free introductions on the trading techniques.

technical analysis formula
The technical analysis takes into consideration the past price history of the security.

day trading tutorial
Read our free introductions on the trading techniques.

day trading how to
Grab the stock quotes using the Stock Downloader program.

macd formula
MACD indicator can be used on stock price. However, it can also be applied to the other indicators, providing us with the information on the direction and speed of changes.

trading system
Usually, one indicator is not enough to build a complete trading system. You need at least momentum indicator, stochastic indicator and stop criteria.

historical intraday data
When downloading the historical intraday data, you may leave the Stock Downloader unattended for couple of months. It will keep the system clock correct, reboot, if you select this option, and reconnect to the Internet at the beginning of the trading session.

technical investment analysis
The technical investment analysis doe not care about company - all it uses is the stock price history.

online day trading education
Subscribe to our 5 e.mails trading course

day trading faq
Check them, before spending any money.

stock market quote historical
Historical quotes can be downloaded for you automatically with the Stock Downloader program.

trading course
Subscribe to our 5 e.mails trading course

historical daily stock quote
There are many online sources, offering historical daily stock quotes. You need, however, to be aware of possible problems with data, some providers offer, such as gaps, spikes etc.

free real time streaming stock quote
There are also providers, offering free real time streaming stock quotes. Usually it comes with the "free trial" of their software packages. Some of these sources are reliable and accurate enough.

day profit trading
Day trading is at the borderline between profit and risk. Some people say it is impossible to consistently win at such short time frame, while some other say - it is.

previous stock quote
You can not possibly trade based only on thecurrent stock price. You need to analyze the history, at least, the previous stock price. Quote history should be always at hand.

ppo software
There are some companies, offering it. We do not have enough experience in that area.

current quote stock yahoo
Yahoo is one of the most known public data providers. Both current stock quotes, and stock history is available on most securities.

archive quote stock
It has to be mentioned, that stock quote archives, available online, are often of very high quality. Sometimes you may see them offered for a fee, usually, it means minute time frame and large (> 600 mb) amount of data.

historical market quote stock
Both historical stock quotes and last minute market information should be studied, as any trading system may produce errors, and it is the last minute information, that allows us to catch them.

review software stock trading
Stock and Forex trading software does not necessarily have to be expansive. As many reviews suggest, the most convenient packages include "free time unlimited demo account", and free trading client as well. A good example is www.metaquotes.net - a company, that has one of the best FOREX trading platforms, which is completely free.

stock trend chart
Stock prices move in trends, which can be analyzed on charts. This is one of the cornerstones of technical analysis.

quick quote stock
The time delay is inacceptable, when you do intraday trading. There are many data providers, offering free or almost free stock quotes, without a delay.

day living trading
Can you live off the day trading? There are many examples, supporting this point of view, however, it seems that most of the day traders loose.

history market quote stock
There are many reviews available on the history of the stock market. Some of them are based on the Dow theory, some - on the waves, and so on.

sp 500 trading system
SP 500 is an index, and as such, it contains much less noise. It makes it a perfect trading instrument, and you can use all tools from the technical and fundamental analysis.

formula macd
MACD indicator is described in details, with formulas, Cortex scripting code and charts, on this site, in the corresponding article.

free system trading
There are many trading forums online, and almost all of them offer free trading systems. Some of them are half-tested, while some are market-ready.

stock day trading tip
The most important day trading tip is to learn as much as you can, before you risk your money, rather than start as soon as you can.

commodity market system trading
The trading - in any market, including commodity market - requires a system. It means you need to know in advance, what to do in any situation, so that you don't have to waste time, desiding.

definition ppo
See online sources.

best system trading
What trading system is the best? As trading is a balance between the risk and the reward, the best system is case-dependent. It is up to you to figure out your risk tolerance.

investing quote stock
Using stock quotes to trade as a mean of an investment is not a single approach, but rather many different approaches, involving different methods of analysis, and different paradigmas.

free software stock trading
It is our belief, that a trading platform must be free. Only this way, the trader can get used to it before he invests.

day trading tool
As an example of a day trading tool, consider a MetaTrader. Note: this site does not represent MT. We just like the tool.

free live stock quote
The situation with free live stock quotes is constantly changing to the best. To find the best available offer, do a research on the Internet trading forums.

free streaming stock quote
When you do a day end trading, you don't need a streaming data feed. However, it is required for intraday.

stochastic definition
On this site, you will find both the definition of stochastic indicator, and the source code to implement it.

simulator trading
There are some fine simulators available free of charge, one example is a MetaTrader. However, a real time trading is always different, and the difference is often to the worse.

wmt stock quote
See finance.yahoo.com

day trading simulation
As an example, consider MetaTrader simulator. It emulates intraday ticks, creating reasonably accurate testing environment.

day trading pattern
Patterns are widely used in day trading, as the mater of fact, as price charts are fractal, any time frame can benefit from this approach.

stock quote download
Stock quotes can be downloaded from Yahoo (one possible way to automate this task is to use a free script that comes with Cortex).

historical stock quote free
Yahoo is probably the first thing that comes to mind, unless you need something very specific.

download historical quote
To download, simply go to their site, enter the ticket and select the time frame.

stock index trading system
Indexes are similar to the stocks, exept two things. First, thei have much less "noise". Second, the liquidity is much better. So by all means, they are good instruments.

current own quote stock yahoo
Yahoo is a well known stock quotes provider, they are delayed, though.

yahoo finance stock quote
Also, day end information at Yahoo is delayed, too.

past stock quote
Historical (past) stock quotes are used for technical analysis.

day trading simulator
Simulators can be used to test day trading systems, however, nothing can replace a real time demo account.

free stock trading system
There are many stock trading systems in the Internet, available free of charge.

best stock trading system
The best stock trading system is the one that suits your risk - reward ideas.

stock trading simulator
There are many stock trading simulators available online, some of them are free.

yahoo stock quote
Yahoo stock quote is one of the well known and reliable free services.

historical stock quote
Historical stock quotes can be obtaines from many sources, from free Yahoo, to commercial Reuters.

trading indicator
There are many trading indicators, available on this site. It includes both the description, and the source code.