Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs 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 01-17-2009, 09:41 PM
Member
 
Join Date: Dec 2007
Location: Outside Stockholm
Posts: 45
ingvar_e is on a distinguished road
Advanced coding with DLL

I am trying to create a DLL library with Microsoft Visual Basic 6.

I have written DLL:s for other applications than MT4 with VB6. The problem is that you get forced into a structure that demands that you call the DLL in this fashion (in VB):

Dim someObj
Set someObj = CreateObject("someDLL.SomeCodeModule")
someObj.SomeFunction parm1 parm2.....

As far as I figure this kind of setup is not possible in Metatrader.

I have tried lots of variation to code the DLL inVB6 to allow the simpler calling method that can be used in MT4 but not succeeded.

Anyone done this?

Ingvar
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 01-17-2009, 10:32 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
What do you want your dll to accomplish?
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
  #3 (permalink)  
Old 01-17-2009, 11:07 PM
Member
 
Join Date: Dec 2007
Location: Outside Stockholm
Posts: 45
ingvar_e is on a distinguished road
The DLL will act as an intermediate between MT4 and an Excel spreadsheet both delivering data to the spreadsheet and collect data. I have no problem communicating with the spreadsheet. Its communicating with MT4 that is the problem. The structure of the EA:s I have built have all required the calling structure described and that is not suitable for MT4 it seems.
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
  #4 (permalink)  
Old 01-18-2009, 03:55 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Quote:
Originally Posted by ingvar_e View Post
The DLL will act as an intermediate between MT4 and an Excel spreadsheet both delivering data to the spreadsheet and collect data. I have no problem communicating with the spreadsheet. Its communicating with MT4 that is the problem. The structure of the EA:s I have built have all required the calling structure described and that is not suitable for MT4 it seems.
You may be having a string problem. Are you having mt4 read a double value such as a price quote from Excel? If Excel is returning a string, you may need to convert this to a double in mt4. Not sure if that is your problem or not.

I only have experience reading and writing to .txt or .csv files. Often you have the need to convert a string value to a double or integer for mt4 to make sense of your values.

Some of these mq4 functions may be helpful:

StrToDouble( string value)
StrToInteger( string value)
StrToTime( string value)

Not sure if this is helpful to you or not.
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
  #5 (permalink)  
Old 01-18-2009, 04:57 AM
Junior Member
 
Join Date: Jan 2009
Posts: 2
StooperTwada is on a distinguished road
Thumbs up Do you Have an Excel to Saxo Trader interface?

@ingvar_e; you said...
Quote:
I have written DLL:s for other applications than MT4 with VB6....
Have you ever tried an excel interface for Saxo Trader dll's or know anyone who has attempted this? I would be interested in getting a feed similar to the excel command/formula in MT4 for saxo trader e.g. =(MT4|BID!GBPUSD) for the currency pairs they provide plus an interface to place trades on the trade board via excel.

If you know of a past thread etc, I would be very interested in any information you may have as I have all my trade analysis/alerts and back test macros for end of day info that I fat finger in and would like to go to intraday time frames.

And please excuse me for asking this is a MetaTrader thread. I have been searching for this for a while.....
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
  #6 (permalink)  
Old 01-18-2009, 06:49 AM
Junior Member
 
Join Date: Jan 2009
Posts: 2
StooperTwada is on a distinguished road
I Withdraw My Above Request!

Sorry - for some reason I do not have edit rights to delete my above response. I hereby withdraw the above request on the grounds that it is in breach of the customer agreement.

I am now highly considering closing my account with Saxo....
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
  #7 (permalink)  
Old 01-18-2009, 08:22 AM
Member
 
Join Date: Dec 2007
Location: Outside Stockholm
Posts: 45
ingvar_e is on a distinguished road
Wolfe wrote:
>You may be having a string problem

No, It is a problem even to get in contact with the DLL since the DLL require you to instanciate the DLL (See sample code for calling the DLL from VB).

I have to rephrase one of my sentences.

The structure of the DLL:s I have built have all required the calling structure described and that is not suitable for MT4 it seems

Ingvar
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
  #8 (permalink)  
Old 01-18-2009, 07:23 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Example code of .ccp:

PHP Code:
// Your_dll.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "Your_dll.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define MT4_EXPFUNC __declspec(dllexport)


// CYour_dllApp

BEGIN_MESSAGE_MAP(CYour_dllAppCWinApp)
    
//{{AFX_MSG_MAP(CYour_dllApp)
        // NOTE - the ClassWizard will add and remove mapping macros here.
        //    DO NOT EDIT what you see in these blocks of generated code!
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CYour_dllApp construction

CYour_dllApp::CYour_dllApp()
{
    
// TODO: add construction code here,
    // Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CYour_dllApp object

CYour_dllApp theApp;

MT4_EXPFUNC void __stdcall Your_Function()
{
 
// Your Function code here
 // 

Make sure you declare your export function in the .def file:

PHP Code:
Your_dll.def Declares the module parameters for the DLL.

LIBRARY      "Your_dll"
DESCRIPTION  'Your_dll Windows Dynamic Link Library'

EXPORTS
    
Explicit exports can go here

    Your_Function 
Make sure to copy your release dll project to C:\WINDOWS\system32. Mt4 can access your dll there.

Last edited by wolfe; 01-18-2009 at 07:37 PM.
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
  #9 (permalink)  
Old 01-18-2009, 07:43 PM
Member
 
Join Date: Dec 2007
Location: Outside Stockholm
Posts: 45
ingvar_e is on a distinguished road
Thanks Wolfe.

You have to forgive me ignorance. I do not really know what to do with code samples you provided. PHP? Not familiar with PHP at all. Looks more like C yo me.

Like the pupil said after having got a second explanation.

"I am still confused but at a substantial higher level"
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
  #10 (permalink)  
Old 01-19-2009, 02:47 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Quote:
Originally Posted by ingvar_e View Post
Thanks Wolfe.

You have to forgive me ignorance. I do not really know what to do with code samples you provided. PHP? Not familiar with PHP at all. Looks more like C yo me.

Like the pupil said after having got a second explanation.

"I am still confused but at a substantial higher level"
Sorry, it's not Visual Basic. The examples are in visual C++ 6.0.

Mt4 dll's will work when coded in C++.
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

Tags
dll, vb6


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
>>Advanced GET & 4X<< kappari Tools and utilities 14 07-19-2009 06:43 AM
Advanced GET peregrinus Non Related Discussions 28 07-19-2009 06:37 AM
ADVANCED Idea of the RSI-Alert-Indicator!!-Further help requested! Heavy-Trader Indicators - Metatrader 4 4 07-30-2008 05:14 AM
Open Condition -- Need Advanced Programming Help SaxMan Metatrader 4 2 04-12-2007 05:28 PM


All times are GMT. The time now is 04:08 PM.



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