Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 984
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If you know what condition to add or how to implement (if it's easy), please share.
I can, but it's not interesting to check how it works, so here's an outline
I can, but it's not interesting to check how it works, so I just sketched it out.
Igor, thank you. And no need to check, I'll do it myself, of course.
Is there any way to do it without waiting for a tick?
So that the request for opening went immediately when the "push" is pressed.
It is like a standard "buy/sell" button of quick opening of deals in the terminal (on the left-top of the chart). You press it and the sell opens instantly. All you need is to open a basket of orders instead of a single trade, without waiting for the tick.
There are two implementations (as I see it):
1) either a button (similar) on the chart that opens the basket,
2) or an Expert Advisor. The advisor seems more convenient to me, as it can repeat the request to open (if there are problems) faster than I can.
UPD
Your code works, opens on a new tick, cool, thanks)
UPD
I also remembered: copyers have parameter "ms", where you can set the check time. And if the master has an open deal, it can send a request for opening a deal from 1 ms slave. I.e., instant opening is feasible
I can, but it's not interesting to check how it works, so here's a sketch
Igor, please check by eye, is this opening instantaneous, without waiting for a new tick?
int OnInit()
{
//---
static int ticket = -1;
while(!IsStopped() &&ticket<0)
{ if(TerminalInfoInteger(TERMINAL_CONNECTED) && TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) && !IsTradeContextBusy())
{
RefreshRates();
ticket = OrderSend("EURUSD", OP_SELL, 0.01, Bid, 3, 0, 0, "", 0, 0, clrRed);
if(ticket > 0) break;
}
Sleep(1);
}
//---
return(INIT_SUCCEEDED);
}
------------------And it seems to work as intended...
Otherwise, it seems to work as intended...
not the best option.... then at least write it that way
but the first option should work clearly if you have thrown on a chart and pressed the autotrade button when you consider it necessary to "standby".
If you want to make a trade, then you should write it that way:
not the best option.... then at least write it that way
but the first option should work clearly if you have thrown on a chart and pressed the autotrade button when you consider it necessary to "standby".
If you want to make a trade, then you should write it that way:
Great! The testing of the variants continues. Vladimir and Igor's variant turned out to be quite fast. In practice, it turned out that trades opened faster when clicking the quick buy button than when using the Expert Advisor. Both variants have advantages and disadvantages. Another curious thing is that if we prescribe in the Expert Advisor which pairs to open one by one, they open one by one and very slowly... and if we set 7 Expert Advisors for each chart (more like no load), then on the contrary - all deals open instantly, NOT in sequence, without delays between orders (but there is still some gap of half a second or a second in the beginning).
I want to try the button on the chart, found the manual, but it only describes the coordinates and stuff. Please advise, where in the "button" script should I write the code to open deal? To click on it on the chart and the deal opened. As in the standard MT quick buy/sell button.
Or how to upgrade the Trade Panel to open a basket of orders?
I want to try the button on the chart, found the manual,
I did not look for the manual, but drew the button )))
If the settings for the symbol will be "", then do not open 0.01 lot on this symbol, lot setting has not done, for as the topic about how to learn, not to look who will do, try to attach yourself if necessary ;)
I did not look for a manual, but drew the button ))))
if the symbol is set to "", then do not open 0.01 lot for this symbol, lot setting has not done, for as the topic about how to learn, not to look who will do, try to attach yourself if necessary ;)
will try
Strange, if in one EA, it opens trades one after the other on each specified currency pair... with a time lag. And when you put it on 5 different charts with different currency pair (symbol(0)), all 5 trades open simultaneously and instantly when you press autotrade.
Can you suggest what it may be and how to fix it? To have everything in one EA and on one chart (so that the button on the chart opens all pairs as fast as when activating "autotrade" with several EAs, as in the original version)