[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 316

 
granit77:
Vladimir, since you posted a compilation, you must have dealt with this issue.
Have you found a ready simple variant of transferring one variable from the terminal to the terminal via memory, Windows variable, etc., i.e. not via file?
As a final variant, an indicator that draws the Close[0] line from another terminal on one terminal online. On a tick chart this comparison would look very clear.

FileMapping

or Atom

https://www.mql5.com/ru/forum/54467

https://www.mql5.com/ru/forum/100455

and FileMapping examples on MSDN

 
trave:
Please help me to exchange data in the fastest way between MT4 terminals on one computer.
Library.
 
drknn:

If you want to copy trades, here is the copier. If you just want to exchange data, you need to make a dll
Thank you.
I found a solution that works quickly and easily: https: //www.mql5.com/en/forum/127032
 
trave:
Thank you.
Found this solution works quickly and easily: https: //www.mql5.com/en/forum/127032Моя library

It's not quick. It goes through files. It will be a pain in the ass for the disk.

My file library is much better.

 
Zhunko:

It's not quick. It's through files. You're going to rape the disk.

My file library is better for working with files.

As far as I understand it transmits through a "named channel" and not through files
 
#import "kernel32.dll"
int CreateNamedPipeA(string pipeName,int openMode,int pipeMode,int maxInstances,int outBufferSize,int inBufferSize,int defaultTimeOut,int security);
int PeekNamedPipe(int PipeHandle,int PassAsZero,int PassAsZero2, int PassAsZero3, int & BytesAvailable[], int PassAsZero4);
int CreateFileA(string Filename, int AccessMode, int ShareMode, int PassAsZero, int CreationMode, int FlagsAndAttributes, int AlsoPassAsZero);
int CloseHandle(int fileHandle);
int ReadFile(int FileHandle, int BufferPtr, int BufferLength, int & BytesRead[], int PassAsZero);
int MulDiv(string X, int N1, int N2);

#import

Definitely not through the disk.

 
trave:
As far as I understood it, the transfer goes through "named channel" and not through files.

I didn't look at it carefully. There it is: CreateNamedPipe().

For transferring data between computers, this is a good option. But it's better to use mapping inside the computer. See link above.

Also it is better not to call the WinAPI functions in MQL4 code. This is very slow and unreliable.

 
granit77:
Vladimir, since you posted a compilation, you must have dealt with this issue.
Have you found a ready simple variant of passing one variable from terminal to terminal via memory, Windows variable, etc., i.e. not via file?
As a final variant, an indicator that draws the Close[0] line from another terminal on one terminal online. On a tick chart this comparison would look very clear.


No I haven't. And now I have to make such an Expert Advisor myself, which transfers data from one terminal to another.

I think I heard somewhere that you can use WinApi

 
Roman.:

Happy holidays to you... :-)))

Thank you
 

Help - the situation has been taken to the point of absurdity !!!

double ticket,sl;
for (cnt = OrdersTotal() - 1; cnt >= 0; cnt--)

    {
    if (!OrderSelect(cnt,SELECT_BY_POS, MODE_TRADES)) continue;
      if (OrderSymbol() != symbol) continue;
      ticket=OrderTakeProfit();sl=OrderStopLoss();
    if (OrderType() == OP_BUY) 
      {
      if (ticket==NormalizeDouble(tpb,Digits)) continue;
      if (!OrderModify(OrderTicket(),OrderOpenPrice(),sl,tpb,0)) Print ("tpb: ",tpb,"  ", ticket-tpb);

      }
    if (OrderType() == OP_SELL) 
      {
      if (ticket==NormalizeDouble(tps,Digits)) continue;
      if (!OrderModify(OrderTicket(),OrderOpenPrice(),sl,tps,0)) Print ("tps: ",tps,"  ", ticket-tps);            

      }
    }

When running this piece of code, the whole log is flooded with this:

14:56:01 xxyyzz GBPUSD,M5: loaded successfully
14:56:01 xxyyzz inputs: step=24; Step_coef=1; TP=10; mult=2; min_lot=0.05; lot_step=50; slippage=3;
14:56:02 2010.12.06 20:10  xxyyzz GBPUSD,M5: open #1 sell 0.05 GBPUSD at 1.5718 ok
14:56:02 2010.12.06 20:10  xxyyzz GBPUSD,M5: modify #1 sell 0.05 GBPUSD at 1.5718 sl: 0.0000 tp: 1.5708 ok
14:56:02 2010.12.06 22:27  xxyyzz GBPUSD,M5: open #2 buy 0.05 GBPUSD at 1.5713 ok
14:56:02 2010.12.06 22:27  xxyyzz GBPUSD,M5: modify #2 buy 0.05 GBPUSD at 1.5713 sl: 0.0000 tp: 1.5723 ok
14:56:02 2010.12.07 00:49  Tester: take profit #1 at 1.5708 (1.5705 / 1.5708)
14:56:02 2010.12.07 02:41  Tester: take profit #2 at 1.5723 (1.5723 / 1.5726)
14:56:03 2010.12.07 20:02  xxyyzz GBPUSD,M5: open #3 sell 0.05 GBPUSD at 1.5784 ok
14:56:03 2010.12.07 20:02  xxyyzz GBPUSD,M5: modify #3 sell 0.05 GBPUSD at 1.5784 sl: 0.0000 tp: 1.5774 ok
14:56:03 2010.12.07 20:17  Tester: take profit #3 at 1.5774 (1.5771 / 1.5774)
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: open #4 buy 0.05 GBPUSD at 1.5763 ok
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: modify #4 buy 0.05 GBPUSD at 1.5763 sl: 0.0000 tp: 1.5773 ok
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:03 2010.12.07 21:11  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
........
........
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: open #5 buy 0.10 GBPUSD at 1.5739 ok
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: modify #5 buy 0.10 GBPUSD at 1.5739 sl: 0.0000 tp: 1.5773 ok
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: tpb: 1.5773  -0
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: modify #5 buy 0.10 GBPUSD at 1.5739 sl: 0.0000 tp: 1.5757 ok
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: modify #4 buy 0.05 GBPUSD at 1.5763 sl: 0.0000 tp: 1.5757 ok
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: tpb: 1.5757  0
14:56:05 2010.12.08 03:31  xxyyzz GBPUSD,M5: OrderModify error 1
........
........ 
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: tpb: 1.5757  0
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: tpb: 1.5757  0
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: open #6 buy 0.20 GBPUSD at 1.5715 ok
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: modify #6 buy 0.20 GBPUSD at 1.5715 sl: 0.0000 tp: 1.5757 ok
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: tpb: 1.5757  0
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: tpb: 1.5757  0
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: modify #6 buy 0.20 GBPUSD at 1.5715 sl: 0.0000 tp: 1.5739 ok
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: modify #5 buy 0.10 GBPUSD at 1.5739 sl: 0.0000 tp: 1.5739 ok
14:56:05 2010.12.08 05:21  xxyyzz GBPUSD,M5: modify #4 buy 0.05 GBPUSD at 1.5763 sl: 0.0000 tp: 1.5739 ok
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: open #7 buy 0.40 GBPUSD at 1.5691 ok
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: modify #7 buy 0.40 GBPUSD at 1.5691 sl: 0.0000 tp: 1.5739 ok
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: modify #7 buy 0.40 GBPUSD at 1.5691 sl: 0.0000 tp: 1.5719 ok
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: modify #6 buy 0.20 GBPUSD at 1.5715 sl: 0.0000 tp: 1.5719 ok
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: modify #5 buy 0.10 GBPUSD at 1.5739 sl: 0.0000 tp: 1.5719 ok
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: modify #4 buy 0.05 GBPUSD at 1.5763 sl: 0.0000 tp: 1.5719 ok
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: tpb: 1.5719  0
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: tpb: 1.5719  0
14:56:05 2010.12.08 07:31  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:06 2010.12.08 09:11  Tester: take profit #4 at 1.5719 (1.5719 / 1.5722)
14:56:06 2010.12.08 09:11  Tester: take profit #5 at 1.5719 (1.5719 / 1.5722)
14:56:06 2010.12.08 09:11  Tester: take profit #6 at 1.5719 (1.5719 / 1.5722)
14:56:06 2010.12.08 09:11  Tester: take profit #7 at 1.5719 (1.5719 / 1.5722)
14:56:07 2010.12.08 20:10  xxyyzz GBPUSD,M5: open #8 buy 0.05 GBPUSD at 1.5796 ok
14:56:07 2010.12.08 20:10  xxyyzz GBPUSD,M5: modify #8 buy 0.05 GBPUSD at 1.5796 sl: 0.0000 tp: 1.5806 ok
14:56:07 2010.12.08 20:33  Tester: take profit #8 at 1.5806 (1.5806 / 1.5809)
14:56:07 2010.12.08 20:49  xxyyzz GBPUSD,M5: open #9 sell 0.05 GBPUSD at 1.5806 ok
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: modify #9 sell 0.05 GBPUSD at 1.5806 sl: 0.0000 tp: 1.5796 ok
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 20:50  xxyyzz GBPUSD,M5: OrderModify error 1
........
........
14:56:07 2010.12.08 21:11  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 21:11  Tester: take profit #9 at 1.5796 (1.5793 / 1.5796)
14:56:07 2010.12.08 21:30  xxyyzz GBPUSD,M5: open #10 buy 0.05 GBPUSD at 1.5795 ok
14:56:07 2010.12.08 21:30  xxyyzz GBPUSD,M5: modify #10 buy 0.05 GBPUSD at 1.5795 sl: 0.0000 tp: 1.5805 ok
14:56:07 2010.12.08 21:48  Tester: take profit #10 at 1.5805 (1.5805 / 1.5808)
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: open #11 sell 0.05 GBPUSD at 1.5806 ok
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: modify #11 sell 0.05 GBPUSD at 1.5806 sl: 0.0000 tp: 1.5796 ok
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 22:10  xxyyzz GBPUSD,M5: OrderModify error 1
14:56:07 2010.12.08 23:59  xxyyzz GBPUSD,M5: tps: 1.5796  -0
14:56:07 2010.12.08 23:59  Tester: order #11 is closed

Error 1 error appears when trying to change TP value equal to tpb or tps value, but why the line in the code

if (ticket==NormalizeDouble(tps,Digits)) continue;

allows to do this ?????!!!!!!!!!