Errors, bugs, questions - page 1797

 
fxsaber:
Why does the double slash act on the backslash? And why does a macro carry a double slash comment when activated?
The comment is not part of the macro. The macro should be continuous. A backslash \ continues the macro from the next line. // at the beginning of the line interrupts the macro because such a line cannot be terminated with a backslash \
 
A100:
A comment is not part of a macro. A macro must be continuous. The inverse \ continues the macro from the next line. // at the beginning of the line interrupts the macro because such a line cannot end with a backslash \
That's what I'm asking why a macro has to consider a line with a double slash? It should.
 

Metaquotes-Demo

SYMBOL_SESSION_PRICE_LIMIT_MIN == 1199.2. But even at the higher price I cannot set BuyLimit.

 
fxsaber:
So I asked, why does the macro consider a line with a double slash? It should.

In this case the comment is replaced with an empty string(the comment text is ignored, while the string itself remains), and the empty string interrupts the macro

#define MACRO  \
  if (true)    \
  {            \
    Print(""); \

  }
 
A100:

In this case the comment is replaced by an empty line

#define MACRO  \
  if (true)    \
  {            \
    Print(""); \

  }
I find this illogical. There shouldn't even be a blank line.
 
fxsaber:
The brakes don't seem to be hard to fix if you write a competent script. Here's what comes up pretty fast at a ping of 50ms
2017.02.10 21:32:42.726 Trades  '5122740': exchange buy 1.00 Si-3.17 at market
2017.02.10 21:32:42.796 Trades  '5122740': accepted exchange buy 1.00 Si-3.17 at market
2017.02.10 21:32:42.806 Trades  '5122740': deal #117193624 buy 1.00 Si-3.17 at 58810 done (based on order #133580668)
2017.02.10 21:32:42.808 Trades  '5122740': order #133580668 buy 1.00 / 1.00 Si-3.17 at 58810 done in 81.663 ms
2017.02.10 21:32:42.810 Trades  '5122740': modify #133580668 buy 1.00 Si-3.17 sl: 0, tp: 0 -> sl: 58710, tp: 58910
2017.02.10 21:32:42.886 Trades  '5122740': accepted modify #133580668 buy 1.00 Si-3.17 sl: 0, tp: 0 -> sl: 58710, tp: 58910
2017.02.10 21:32:42.888 Trades  '5122740': modify #133580668 buy 1.00 Si-3.17 -> sl: 58710, tp: 58910 done in 78.188 ms
2017.02.10 21:32:42.888 Trades  '5122740': exchange sell 1.00 Si-3.17 at market, close #133580668 buy 1.00 Si-3.17 58810
2017.02.10 21:32:43.079 Trades  '5122740': accepted exchange sell 1.00 Si-3.17 at market, close #133580668 buy 1.00 Si-3.17 58810
2017.02.10 21:32:43.079 Trades  '5122740': deal #117193626 sell 1.00 Si-3.17 at 58810 done (based on order #133580670)
2017.02.10 21:32:43.080 Trades  '5122740': order #133580670 sell 1.00 / 1.00 Si-3.17 at 58810 done in 192.146 ms
2017.02.10 21:32:43.081 Trades  '5122740': buy limit 1.00 Si-3.17 at 58713
2017.02.10 21:32:43.221 Trades  '5122740': accepted buy limit 1.00 Si-3.17 at 58713
2017.02.10 21:32:43.222 Trades  '5122740': order #133580671 buy limit 1.00 / 1.00 Si-3.17 at market done in 141.851 ms
2017.02.10 21:32:43.222 Trades  '5122740': cancel order #133580671 buy limit 1.00 Si-3.17 at 58713
2017.02.10 21:32:43.652 Trades  '5122740': accepted cancel order #133580671 buy limit 1.00 Si-3.17 at 58713
2017.02.10 21:32:43.653 Trades  '5122740': cancel #133580671 buy limit 1.00 Si-3.17 at market done in 430.484 ms
Just a reminder, this is Metaquotes-Demo. Can't handle MT5 load for some reason.
Similarly
2017.02.13 12:44:48.104 Trades  '5122740': buy limit 1.00 RTS-12.17 at 114430
2017.02.13 12:44:48.737 Trades  '5122740': accepted buy limit 1.00 RTS-12.17 at 114430
2017.02.13 12:44:48.739 Trades  '5122740': order #133670570 buy limit 1.00 / 1.00 RTS-12.17 at market done in 634.624 ms
This is a response to a request like this.
Request.action = TRADE_ACTION_PENDING (5)
Request.magic = 0
Request.order = 0
Request.symbol = RTS-12.17
Request.volume = 1.0
Request.price = 114430.0
Request.stoplimit = 0.0
Request.sl = 0.0
Request.tp = 0.0
Request.deviation = 100
Request.type = ORDER_TYPE_BUY_LIMIT (2)
Request.type_filling = ORDER_FILLING_RETURN (2)
Request.type_time = ORDER_TIME_DAY (1)
Request.expiration = 1970.01.01 00:00:00
Request.comment = My Order
Request.position = 0
Request.position_by = 0
Result.retcode = 10009
Result.deal = 0
Result.order = 133670570
Result.volume = 1.0
Result.price = 0.0
Result.bid = 0.0
Result.ask = 0.0
Result.comment = Request executed 634.708 + 0.002 ms
Result.request_id = 5827
Result.retcode_external = 0
MT5 is slowing down, unfortunately.
 
fxsaber:
MT5 is slowing down, unfortunately.

Even cooler - the demo was 1.5 seconds of marching!

'5122740': accepted exchange sell 1.00 DINRM at market, close #133675792 buy 1.00 DINRM 149.07
'5122740': deal #117297621 sell 1.00 DINRM at 149.07 done (based on order #133675793)
'5122740': order #133675793 sell 1.00 / 1.00 DINRM at 149.07 done in 1596.317 ms

Query

Request.action = TRADE_ACTION_DEAL (1)
Request.magic = 0
Request.order = 0
Request.symbol = DINRM
Request.volume = 1.0
Request.price = 149.04
Request.stoplimit = 0.0
Request.sl = 0.0
Request.tp = 0.0
Request.deviation = 100
Request.type = ORDER_TYPE_SELL (1)
Request.type_filling = ORDER_FILLING_RETURN (2)
Request.type_time = ORDER_TIME_GTC (0)
Request.expiration = 1970.01.01 00:00:00
Request.comment =
Request.position = 133675792
Request.position_by = 0
Result.retcode = 10009
Result.deal = 117297621
Result.order = 133675793
Result.volume = 1.0
Result.price = 149.07
Result.bid = 149.04
Result.ask = 149.06
Result.comment = Request executed 1596.364 + 0.209 ms
Result.request_id = 13486
Result.retcode_external = 0
 
Cannot find out the slippage parameter of a hanging market order, which is set in Request.deviation.
 
fxsaber:
I find this illogical. There shouldn't even be an empty string.
// means that the comment is after, not that the entire string is a comment. Remove // and you get an empty string. For comparison, add spaces in front of //
 
A100:
// means that the comment is after it, not the whole string is a comment. If you remove //, you get an empty string

Agreed! But in the case of macros, this is inconvenient.

Imagine you take a piece of code and want to make it a macro. For example, replace a function with a macro.

It would seem, you put a backslash at the end of each line, and it's done. But no! You should replace double slashes with /* */. And if /* */ is not in one line, it's too bad.