Questions from Beginners MQL5 MT5 MetaTrader 5 - page 291

 
VitalyGnutov:
Hello. I have a question like this. I have just started studying MQL, and I must be doing something wrong, but I don't know where and what exactly. The matter is this: I am writing an Expert Advisor (in this case a trivial "martingale" combined with "10 pips per day"). In the Strategy Tester it gives results, which in principle I am satisfied with. Everything seems to work, but (!) only until I do not put it for real. It simply does not work. It doesn't open trades when it should, and there are no messages in the Experts tab or in the Journal. What am I doing wrong? I'm not sure what to do with it.

You have no error handling when opening orders.

For example:

OrS=OrderSend(Symbol(),OP_SELL,AccountBalance()*Risk/10000*(1<<i),Ask,2,Bid+10*Point,Bid-10*Point,NULL,0,0,clrRed);

You want to open a short Ask position and set SL and TP at the same time.

Firstly, not all brokers allow you to do this. Open an order with zero SL & TP, then modify it.

Secondly, if you have 4-digit quotes, then modification at Bid+10*Point will still work, for 5-digit brokers it will not, as SL/TP will be too close to the current price.

Third, always check the result in the OrS variable, if there is -1, then check GetLastError() to clarify the error.

 
elugovoy:

You have no error handling when opening orders.

For example:

You want to open a short Ask position and set SL and TP at the same time.

Firstly, not all brokers allow you to do this. Open an order with zero SL & TP, then modify it.

Secondly, if you have 4-digit quotes, then modification at Bid+10*Point will still work, for 5-digit brokers it will not, as SL/TP will be too close to the current price.

Third, always check the result in the OrS variable, if there is -1, then check GetLastError() to clarify the error.

Thanks, I'll try without SL\TR, but I think in that case I'd get error 130 when the server responds. But the problem is that there is not even an attempt to open an order.

I was writing for 4-digit quotes, so I didn't bother with this point until demanded. In any case, I am thinking to implement manual setting of TP and SL during initialization.

GetLastError is relevant when I expect some error and am ready to create an exception for it. But I usually try to avoid such situations. In order to know the error number, it is enough to see the EA log.

Thanks anyway) I will try to play with stops after all.

 

Hello, I would like to ask you to help me to understand the MT5 terminal. I traded in Kvik before, in other markets.

Attached are screenshots of the same section of the chart with the trend line (resistance line marked in blue) at different timeframes.

What is confusing is that the same trend line is located absolutely differently in different timeframes.

Moreover, it is not an error (like in Quick Fix, for instance), but a colossal difference. For me it is critical.

I do not even consider the timeframe less than one hour because this line is not present on them at all!

For me it is critical. Maybe I should tighten something in the settings, or maybe it should be like this (I'm slightly shocked, then).

Please, explain it to me.

Files:
vv61pv.jpg  775 kb
h0a9.jpg  793 kb
4s.jpg  693 kb
1h.jpg  764 kb
 

One more question. Attached is a screenshot of a candlestick chart with some candlesticks highlighted in green (where the opening and closing price coincide)

Why is it highlighted? Where can I disable it?

Thanks in advance for the tip.


I am writing my questions in this thread because I did not find a dedicated MT5 thread on the forum.

Files:
svechi.jpg  721 kb
 
ShamilY:

One more question. Attached is a screenshot of a candlestick chart with some candlesticks highlighted in green (where the opening and closing price coincide)

Why is it highlighted? Where can I disable it?

Thanks in advance for the tip.


I am writing my questions in this thread because I did not find a dedicated MT5 thread on the forum.

In the terminal colour settings (F8). "Line" in my opinion.
 
ShamilY:

Hello, I would like to ask you to help me to understand MT5 terminal. I traded on other markets using Quickswitch before.

Attached are screenshots of the same section of the chart with the trend line (resistance line marked in blue) at different timeframes.

What is confusing is that the same trend line is located absolutely differently in different timeframes.

Moreover, it is not an error (like in Quick Fix, for instance), but a colossal difference. For me it is critical.

I don't even want to trade on TFs less than 1 hour because this line is not present on them at all!

Maybe I should tighten something in the settings somewhere or it should be like this (I'm slightly shocked then).

Please, explain it to me.

Maybe, it would be better, if you place the attachment points of the trend line more precisely, on D1 or less, so that they don't "hang" in the air.

But in general, this is a bug, write to servicedesk (in the profile).

ps there's that old no joke: the lines in MT intersect. This problem is older than MT5. If you want geometry on the chart - I'm afraid MT5, for all its merits, is not your choice.

 
ShamilY:
...

Posting my questions in this thread as I couldn't find a dedicated MT5 thread on the forum.

It's OK, the whole forum is about MT5. Almost.
 
Silent:

Maybe it would be a bit better if you placed the trendline anchor points more accurately, on D1 or less, so that they don't "hang" in the air.

But in general it's a bug, write to servicedesk (in the profile).

ps there's that old no joke: the lines in MT intersect. This problem is older than MT5. If you want geometry on the chart - I'm afraid MT5, for all its merits, is not your choice.

Thanks, I got it. So it's not just me (my broker) who has it. I trade by levels (manually, without indicators). I didn't think it was so bad in terms of basic (simplest) tools in the super-promoted MT. Yes, I'm trying to make trends on lower TFs. But then I just do not see important (global) market points defined in older TFs, unfortunately. After all the older is the TF the more significant are its levels, extrema, etc.
 
artmedia70:
In the terminal colour settings (F8). "Line" in my opinion.
Thank you. Not there. It's the candle that's highlighted in colour, not the line.
 
ShamilY:
Thank you, I understand. So it's not just me (my broker). I trade by levels (manually, without indicators). I didn't think it was so bad from the point of view of the basic (simplest) tools in the super-promoted MT. Yes, I'm trying to make trends on lower TFs. But then I just do not see important (global) market points defined in older TFs, unfortunately. After all the older is the TF the more significant are its levels, extrema etc.
As an alternative - to set 1 chart = 1 TF and not to switch timeframes.
Reason: