Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1072
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
Thank you. I'll look into it.
And thank you, you reminded me of an old system that used to work in profit. I need to make a note of it at my leisure and test it in the current market.
Hi all. I am new to programming.
More options:
1. When opening Buy, put SellStop order at the level of stop loss of Buy order. Then your wish will be fulfilled by the server. But in exceptionally rare but accurate situations and not :-)
2. Not to put Stop Loss at all, and put SellStop of double volume. This will also be processed by the server quickly. At the end of the day or when the margin is depleted, you need to run some UnLock, which closes opposite orders mutually (CloseBy).
However, there is another nuance - stop orders (and stop loss, too) may not work. And this is quite often.That is, in a "combat" robot, we still have to double-check it.
He writes that you cannot initialize a wchar_t entity with a const char* value
If you don't understand it, unfortunately, you don't have the basics of the language. It's too early for you to write a dll, especially for such a specific language as mql. Start with the basics.
I do not know what they advise you to do. There will never be a good time for this moment of learning libraries either now or never.
2. do not put a stop loss at all, but put a SellStop of double volume. This will also be handled by the server and quickly. At the end of the day or when the margin is depleted, you need to run some UnLock, which closes opposite orders mutually (CloseBy).
We should be more careful with CloseBy as not all brokerage companies support this feature.
I'm not a programmer, so I can't solve the simplest question: how to bind zero bar to time, minutes :00, hours 00:,01:,02: etc. Can someone suggest it?
There is a function for this.
iTime(символ,таймфрейм, номер бара)
It returns the bar time.
Hi all. Guys, please help. i am new to programming.
How to achieve this in MQL4 code.
For example, I will press button A and a cursor <Screenshot_2> will appear on a chart like this.
On the Draw Rectangle <Screenshot_1> there is no hotkey.How to get this function.
Screenshot_1
Screenshot_2.
Thank you.
Please help with the buy-sell switch, I'm just learning!
void OnTick()
{
MAprice=iMA(Symbol(),0,MAperiod,MAshift,MODE_SMA,PRICE_CLOSE,1);
if(CountBuy() + CountSell() == 0 && Ask > MAprice)
{
if(OrderSend(Symbol(),OP_BUY,lot,Ask,slip,0,0,NULL,magic,0,clrBlue)<1)
Print("Failed to open a Buy order!");
if(CountBuy()>=1)
{
price = FindLastBuyPrice();
if((price - Ask) >= step*Point)
{
if(OrderSend(Symbol(),OP_BUY,lot,Ask,slip,0,0,NULL,magic,0,clrBlue)<1)
Print("Failed to open a Buy order!)
}
}
if(CountBuy() + CountSell() == 0 && Bid < MAprice)
{
if(OrderSend(Symbol(),OP_SELL,lot,Bid,slip,0,0,NULL,magic,0,clrRed)<1)
Print("Failed to open Sell order!)
}
}
if(CountSell()>=1)
{
price = FindLastSellPrice();
if((price -Bid) >= step*Point)
{
if(OrderSend(Symbol(),OP_SELL,lot,Bid,slip,0,0,NULL,magic,0,clrRed)<1)
Print("Failed to open Sell order!");
}
}
double op = CalculateProfit();
if(op>=profit)
{
CloseAll();
}
}
//+------------------------------------------------------------------+
void CloseAll()
or where to learn?
There is a function for this.
It returns the bar time.