ExcelExportTest

Download script
Author: Copyright 2012, Stephen Ambatoding
ExcelExportTest

This script is designed to automate the process of sending specific data from your trading platform directly into a Microsoft Excel spreadsheet. It acts as a bridge, allowing for seamless communication between your live trading environment and your office documents.

How it Works

The logic follows a straightforward three-step sequence to ensure that your information is recorded accurately without manual intervention:

1. Establishing the Connection When the script is activated, its first priority is to "knock on the door" of your Excel application. It looks for a specific sheet name (which you can define) to ensure it is placing data in the correct location. If the script cannot find or open the spreadsheet, it will trigger an alert to notify you immediately that the connection failed.

2. Delivering the Data Once a successful connection is confirmed, the script moves to the action phase. It targets a specific cell coordinate—much like giving someone a precise map—and inserts the pre-defined text or value you have provided. This allows you to automate the logging of information, such as notes, status updates, or custom messages, into your records instantly.

3. Safe Closure After the data has been successfully written, the script performs a "clean exit." It automatically disconnects from the Excel file and releases the resources it was using. This is an important safety step that ensures your spreadsheet remains stable and prevents the software from hanging or causing conflicts with other open programs.

Key Features for Users

  • Customizable Destination: You can easily change which sheet the script looks at and exactly which cell the information should land in.
  • Automated Alert System: The script provides instant feedback, letting you know if it successfully completed the task or if there was an issue with the connection.
  • Seamless Integration: It simplifies your workflow by removing the need to manually copy and paste information from your trading platform into your accounting or tracking sheets.
Miscellaneous
It issuies visual alerts to the screen
3 Views
0 Downloads
0 Favorites
ExcelExportTest
//+------------------------------------------------------------------+
//|                                            ExcelExportOrders.mq4 |
//|                               Copyright 2012, Stephen Ambatoding |
//|                             http://www.forexfactory.com/sangmane |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, Stephen Ambatoding"
#property link      "http://www.forexfactory.com/sangmane"

#property show_inputs

extern string Sheet = "Sheet1";
extern string CellAddress = "R2C2";
extern string CellValue = "From Indonesia with Love";

#import "ExcelExportLib.ex4"         
	int ExcelInit(string Sheet);
	void ExcelDeinit();
	int ExcelWrite(string CellAddress, string CellValue);

int start()
{
	int iRet;
	iRet = ExcelInit(Sheet);
	if (iRet == 0)
	{
		Alert("ExcelInit failed!");
		return (0);
	}

	iRet = ExcelWrite(CellAddress, CellValue);	
	if (iRet == 0)
	{
		Alert("ExcelWrite failed!");
	}
	
	ExcelDeinit();
	return (0);
}

Comments