Websocket how? - page 12

 

here

 
Igor Makanu:

tried your example, it didn't work.

Either my VS settings are wrong or there is something wrong with it.

attach the VS project and sample call from MQL5 - it's the right thing to do.

ZS: if memory serves me correctly, it stopped working when MQL5 added namespace

attached

Files:
 

Great!

Alexei, can you recommend a book for learning sharpe?

 
Алексей Барбашин:

The result is in the studio! Don't forget to include screenshots of the final result.

Did you enjoy programming in Sharp?

Yes. The main thing is that you can connect it to MQL


 
I'm sorry, I have to be gone for 30 minutes.
 
Алексей Барбашин:

Vladimir, can you tell me how to get data as a structure from Sharp?


C#

                public static void RefTicks(double open, double close, ref StructTicks ddd) {
                        ddd.Open = open;
                        ddd.Close = close;
                }


MQL

int OnInit() {
   StructTicks tick;
   ConnectorMQL::RefTicks(1.11 ,1.12, tick);
   Print(tick.Open + " / " + tick.Close);
   
   return(INIT_SUCCEEDED);
}
 
Vladimir Suslov:

pinned

Thank you!

strange, your example worked the first time

Created a new project in my place from scratch - copied those 5 lines of code and it works again, ok, I'll believe in magic

Thanks again!

 
I'm here.
 

Still something's wrong, in theory this code should work.

C#

using System;
using System.Runtime.InteropServices;

namespace ClassLibrary2
{
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct MqlTick
    {
        public Int64 Time;
        public Double Bid;
        public Double Ask;
        public Double Last;
        public UInt64 Volume;
    }
    public class tst
    {
        public static void CopyTick(ref MqlTick inTick, ref MqlTick outTick)
        {
            outTick = inTick;
        }
    }
}

MQL5

#import "ClassLibrary2.dll"
#import
//+------------------------------------------------------------------+
int OnInit()
{
   MqlTick t1,t2;
   tst::CopyTick(t1,t1);
   return(INIT_SUCCEEDED);
}

I get compile errors, that t1 parameter cannot be converted

 
Алексей Барбашин:

Shall we continue?