Questions from Beginners MQL5 MT5 MetaTrader 5 - page 564

 

Afternoon!

The Buy and Sell EA does not wantto open a positionfor some reason. Can you tell me why?
Files:
 

Here's another problem.

I'm getting data from the history.

  for(int i=0;i<HistoryDealsTotal();i++){
       ulong deal_ticket=HistoryDealGetTicket(i);
       Print("ticket=",deal_ticket);
       Print("Magic=",HistoryDealGetInteger(deal_ticket,DEAL_MAGIC));
}

I get this.

0 21:52:00.487 Core 1 2016.04.01 00:00:00 Number of bars in the terminal history for the symbol-period GBPUSD at the moment = 92607
RR 0 21:52:00.488 Core 1 2016.04.01 05:55:00 1 lot 0.01 Trading attempt
FS 0 21:52:00:488 Core 1 2016.04.01 05:55:00 market sell 0.01 GBPUSD sl: 1.43921 tp: 1.43025 (1.43405 / 1.43417 / 1.43405)
DP 0 21:52:00.488 Core 1 2016.04.01 05:55:00 deal #2 sell 0.01 GBPUSD at 1.43405 done (based on order #2)
FM 0 21:52:00.488 Core 1 2016.04.01 05:55:00 deal performed [#2 sell 0.01 GBPUSD at 1.43405]
GD 0 21:52:00.488 Core 1 2016.04.01 05:55:00 order performed sell 0.01 at 1.43405 [#2 sell 0.01 GBPUSD at 1.43405]
HG 0 21:52:00.488 Core 1 2016.04.01 05:55:00 Opens=true Symb=GBPUSD
GQ 0 21:52:00.488 Core 1 2016.04.01 13:34:58 take profit triggered sell 0.01 GBPUSD 1.43405 sl: 1.43921 tp: 1.43025 [#3 buy 0.01 GBPUSD at 1.43025
IS 0 21:52:00.488 Core 1 2016.04.01 13:34:58 deal #3 buy 0.01 GBPUSD at 1.43025 done (based on order #3)
JN 0 21:52:00.488 Core 1 2016.04.01 13:34:58 deal performed [#3 buy 0.01 GBPUSD at 1.43025]
KP 0 21:52:00.488 Core 1 2016.04.01 13:34:58 order performed buy 0.01 at 1.43025 [#3 buy 0.01 GBPUSD at 1.43025]
JE 0 21:52:00.488 Core 1 2016.04.01 13:34:58 Opens=false Symb=GBPUSD
DL 0 21:52:00.488 Core 1 2016.04.01 13:34:58 ticket=1
JI 0 21:52:00.488 Core 1 2016.04.01 13:34:58 Magic=0
CN 0 21:52:00.488 Core 1 2016.04.01 13:34:58 ticket=2
KJ 0 21:52:00.488 Core 1 2016.04.01 13:34:58 Magic=12345
JO 0 21:52:00.488 Core 1 2016.04.01 13:34:58 ticket=3

FD 0 21:52:00.488 Core 1 2016.04.01 13:34:58 Magic=0

It turns out that Magic Number did not go to trade after take profit triggered. It's not supposed to be like this.... What is the problem ?

I need to filter out the triggered orders but the magic number is missing......

I'm just trying to somehow link the triggered trade to the order I sent myself.

Z.I. Found a partial answer to my question. As far as I understood all positions that were closed at normal stop or profit have zero magic. Pardon my French, but that's bullshit :-(.

 

Hello colleagues!

I don't know if this question has been discussed somewhere, but after two days of searching I couldn't find the answer. I am writing a trading assistant, who would do all the dirty work of a trader. In this regard, I have a problem: is there any way the script can automatically calculate the acceptable lot size and show the result in the quick trade window (it is located in the upper left corner of the chart)?

Thank you in advance!

 
Александр Богданов:

Hello colleagues!

I don't know if this question has been discussed somewhere, but after two days of searching I haven't been able to find an answer to it. I am writing a trading assistant, who would do all the dirty work of a trader. In this regard, I have a problem: is there any way the script can automatically calculate the acceptable lot size and show the result in the window of quick trading (in the chart it is located in the upper left corner)?

Thank you in advance!

No. The quick trade window is not available from MQL5. You don't need a script, but an Expert Advisor that will calculate the lot and output the data in the display panel. There will be two buttons "Buy" and "Sell" in this panel.
 

No. The quick trade window is not available from MQL5. You do not need a script, but an Expert Advisor that will calculate the lot and output the data in the display panel. This panel will have two buttons "Buy" and "Sell".

Karputov Vladimir:
Нет. Окно быстрой торговли не доступно из MQL5. Вам нужен не скрипт, а советник, который будет рассчитывать лот и данные выводить в панель индикации. На этой панели будут две кнопки "Купить" и "Продать".


So, did I understand correctly that I have to write my own quick trade window and use it?

 
Александр Богданов:

No. The quick trade window is not available from MQL5. You do not need a script, but an Expert Advisor that will calculate the lot and output the data in the display panel. This panel will have two buttons "Buy" and "Sell".

So, did I understand correctly that I need to write my own quick trade window and use it?

You need to write your own panel. In this panel, you can display anything you like: lot size, trading direction, and so on and so forth. Plus, this panel also needs buttons (for manual trading). Something like this:

Panel

 
Karputov Vladimir:

You need to write your own panel. This panel can display anything you like: lot size, trading direction, and so on and so forth. Plus, this panel also needs buttons (for manual trading). Something like this:

I see, thank you very much.
 
How do I turn off the display of bars, leaving only the current bid/ask/last levels?
 
Anton Zverev:
How can I disable the display of bars, leaving only the current bid/ask/last levels?
In the chart settings, set all candlestick colours to NONE.
 
Karputov Vladimir:
In the chart settings, set all candlestick colours to NONE.
Thank you! And to avoid cluttering up with "Thank you" statements, where can I thank you?
Reason: