NexusFi: Find Your Edge


Home Menu

 





c# and MQL4


Discussion in Platforms and Indicators

Updated
    1. trending_up 10,845 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 15 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
ankityadav
indore+india
 
Posts: 30 since Jun 2013
Thanks Given: 2
Thanks Received: 2

can any one have an idea about how we make a dll in c# so that we can use it into mql4 program

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC Advanced Simulated Trading.
MultiCharts
MC PL editor upgrade
MultiCharts
Radarscreen
TradeStation
Pivot Indicator based on Level2 data
NinjaTrader
Quantum physics & Trading dynamics
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
ApexTraderFunding.com experience and review
108 thanks
1 Minute Man
103 thanks
In futures why does price turn so hard against you
42 thanks
GFIs1 1 DAX trade per day journal
30 thanks
Joes Trading Garage
19 thanks
  #2 (permalink)
tubular2000
Montreal quebec
 
Posts: 16 since Aug 2013
Thanks Given: 0
Thanks Received: 5

can you be more specific? why do you want to write a dll instead of coding straight mql4?

Reply With Quote
  #3 (permalink)
ankityadav
indore+india
 
Posts: 30 since Jun 2013
Thanks Given: 2
Thanks Received: 2


Thank You for the response sir
The problem is when i am using that dll in my mt4 it give me error not load library ea.dll and i make dll in c# to use some of the features of c#

Reply With Quote
  #4 (permalink)
tubular2000
Montreal quebec
 
Posts: 16 since Aug 2013
Thanks Given: 0
Thanks Received: 5

making a dll in mt4 is not for the beginner. you better ask want you want to accomplish and there is probably a better and easier way to do it.

if you want to stick to a dll, have you made your .def file as part of your solution?

Reply With Quote
Thanked by:
  #5 (permalink)
ankityadav
indore+india
 
Posts: 30 since Jun 2013
Thanks Given: 2
Thanks Received: 2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;


namespace ClassLibrary1
{
public class Class1
{
[DllExport("add", CallingConvention = CallingConvention.StdCall)]
public static int add(int n1, int n2)
{
return (n1 + n2);
}
}
}

this is my c# program and i made dll of this program and used unmanagedExports library in it

now
//+------------------------------------------------------------------+
//| UnmanagedExportsDLLExample1.mq5 |
//| Copyright 2010, Investeo.pl |
//| http:/Investeo.pl |
//+------------------------------------------------------------------+
#import "ClassLibrary1.dll"
//#import "http:/Investeo.pl"
double add(int n1,int n2);

int init()
{
}
void start()
{ Print("add function call",(add(21,34)));}

this is my ea where i am using that dll file but when i am running this in to client terminal the error is"cant load library add() funtion."

Reply With Quote
  #6 (permalink)
tubular2000
Montreal quebec
 
Posts: 16 since Aug 2013
Thanks Given: 0
Thanks Received: 5

if all you want to do is add two integer, you better do it in mql4. people who use dll are mostly EA vendors who want to protect their code from copying.

so, if you can't be more specific about what you can't do in mql4 that requires you to write a dll, i'm going to drop the ball.

Reply With Quote
  #7 (permalink)
ankityadav
indore+india
 
Posts: 30 since Jun 2013
Thanks Given: 2
Thanks Received: 2

sir i have to make a software based on c# class library so firstly i am trying to run that dll through this program so have you any idea about how to do that ?

Reply With Quote
  #8 (permalink)
tubular2000
Montreal quebec
 
Posts: 16 since Aug 2013
Thanks Given: 0
Thanks Received: 5

there is no easy way from c# to mt4, use c++ if you can. otherwise for your error message, have you loaded the required libraries?

Reply With Quote
  #9 (permalink)
ankityadav
indore+india
 
Posts: 30 since Jun 2013
Thanks Given: 2
Thanks Received: 2

sir i loaded UnmanagedExports.1.2.5.18722-Debug this library to visual studio 2012 according to given in <http://www.mql5.com/en/articles/249> this website .

Reply With Quote
  #10 (permalink)
tubular2000
Montreal quebec
 
Posts: 16 since Aug 2013
Thanks Given: 0
Thanks Received: 5


in mt4, have you allowed dll import? (toolsptions:expert - allow dll import). have you put your dll in the library folder of the expert folder?

Reply With Quote




Last Updated on August 6, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts