Signal Transmitter/Receiver! - page 11

 

Or, how about this?:

#import "TradeSwitch.dll"

int FlushSignal(string Name);

int SendSignal(string Name, string Value);

string ReceiveSignal(string Name);

#import

extern int Account=1;

string ComPath_T,ComPath_R;

int init()

{

if(Account=1){ ComPath_T="ComPath12"; ComPath_R="ComPath21"; }

if(Account=2){ ComPath_T="ComPath21"; ComPath_R="ComPath12"; }

return(0);

}

int start()

{

SendSignal(ComPath_T, "Text from instance 1 to instance 2.");

string message = ReceiveSignal(ComPath_R);

if (StringLen(message) > 0)

{

Comment("Signal received: ", message);

}

// See signal data in HKEY_CURRENT_USER\Software\TradeSwitch\Signals registry

return(0);

}

This way there is only instance of the EA, which is definable by the properties box in each account.

 
ecTrade:
Yes, in fact I had already tried something like this, except I couldn't get it to work or, talk both ways. But I didn't think it was because I tried incorporating them on the same EA.

Also, what about the FlushSignal() function in the init() of Transmitter EA? Is that no longer required?

int init()

{

// Flush internal signal data

FlushSignal(Symbol());

Comment("Flushed internal data.");

return(0);

}

Thanks!

No, this is not required.

 
ecTrade:
Or, how about this?:
#import "TradeSwitch.dll"

int FlushSignal(string Name);

int SendSignal(string Name, string Value);

string ReceiveSignal(string Name);

#import

extern int Account=1;

string ComPath_T,ComPath_R;

int init()

{

if(Account=1){ ComPath_T="ComPath12"; ComPath_R="ComPath21"; }

if(Account=2){ ComPath_T="ComPath21"; ComPath_R="ComPath12"; }

return(0);

}

int start()

{

SendSignal(ComPath_T, "Text from instance 1 to instance 2.");

string message = ReceiveSignal(ComPath_R);

if (StringLen(message) > 0)

{

Comment("Signal received: ", message);

}

// See signal data in HKEY_CURRENT_USER\Software\TradeSwitch\Signals registry

return(0);

}
This way there is only instance of the EA, which is definable by the properties box in each account.

Yes, it's better, but don't forget to adapt text value in SendSignal. This to see if different communication paths can work.

Regards,

Jeff

 

Wow, I thought I had this thing figured out, but apparently I don't. As far as getting both accounts to talk back and forth, that appears to be working. So, I have to thank you at least for that.

However, what I'm trying to do is a bit more complicated. I'm in the process of creating a hedging strategy using an EA (i.e., US brokers no longer allow hedging, which is why this fix is necessary, to bridge between both accounts), and have up to ten instances of it open on different charts. From there, each instance creates a variable string telling how many open orders there are (and pending), as well as the last open order price, which then get passed on as global variables.

The TradeSwitchProcessor EA (I changed it ) then scans for these globals to see if they've been updated and, if they have, they are processed and transmitted over to the second account, and vice versa. I actually thought I had it working, with all the variables displayed and lined up in a row, so I could see if they were updating correctly and, it looked great! But, come to find out I was only looking at the variables specific to that account, not the variables sent from the other account. So, now I don't know where I'm at?

I'll have to get back to you on this, okay?

Thanks!

 

You are welcome

If there is anything that I can help with, please let me know.

Regards,

Jeff

 

I can send you a copy of the EA's (TradeSwitch and GlobalSimulator) if you like? Sorry I didn't get back to you sooner on this. There were still a couple of things I wanted to look at, which I couldn't address until after trading opened today (Sunday).

I actually did get it to work, at least on one side of it, as it updates the signals (continuously) from the other account. However, the second account doesn't do anything, except display a bunch of 0's where it should display the updates. It also displays the original text message which should only show up when in Test mode.

Now, when I switch both instances to Test mode (at the same time), both display the original text message with the correct information, except the one that updates correctly flashes, and the other one is static. Plus, it always works in the instance you setup as account #1, regardless of which account it is. So, that should tell you something right there, I would think?

If you're interested let me know, okay?

Thanks.

 

Hey, check your PayPal!

I believe I've got one instance of it working, which is really all I need for now.

Thanks Again!

 
ecTrade:
Hey, check your PayPal!

I believe I've got one instance of it working, which is really all I need for now.

Thanks Again!

I have got your donation, thanks.

You are welcome again

Jeff

 
 

Hi! I tried to use this script, but it doesn't work for me. Do you have the working version?

Reason: