Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1056

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
Because you have to read the documentation all the way through. And there is an example in it
In the documentation, I think these brackets "array[]" are unnecessary because you may understand from the word itself that it is an array. :)
So subtract the elapsed time from the number of seconds in a period...
Thanks a lot, I've been using mql4 for five years and didn't know there was such a function, thanks a lot again ))
Alas, it did not help, on the fifth this check does not work...((
i also don't know what does the variable i called huin do?
Thanks a lot, I've been using mql4 for five years and didn't know there was such a function, thanks a lot again ))
Alas, it did not help, on the fifth this check does not work...((
So you should have specified... The principle is the same.
You can also use CopyTime()...
No... It's not like that.
GURUS TELL ME!!!! Why does a Sell order not open????
//+------------------------------------------------------------------+
//| ProjectName |
//| Copyright 2012, CompanyName |
//| http://www.companyname.net |
//+------------------------------------------------------------------+
#property strict
//+------------------------------------------------------------------+
//| Expert initialisation function |
//+------------------------------------------------------------------+
input double L=0.01;
input int TakeProfit = 150;
input int StopLoss = 150;
input int Magic = 0;
//+------------------------------------------------------------------+
int b=0;
int s=0;
//+------------------------------------------------------------------+
int OnInit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//+------------------------------------------------------------------+
//| Open a Buy order ||
//+------------------------------------------------------------------+
if(b==0)
{
b=My_Fun_b();
}
//+------------------------------------------------------------------+
//| Open a Sell order |
//+------------------------------------------------------------------+
if(s==0)
{
double priceb=My_Fun_p();
Comment("The price of the Buy order",priceb);
if(priceb==Bid) /*NOT EXECUTED WHY*/.
{
s=My_Fun_s(priceb);/*NOT EXECUTED, WHY//
}
}
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Custom function for opening the first order (buy) |
//+------------------------------------------------------------------+
int My_Fun_b()
{
b=OrderSend(_Symbol,0,0.01,Ask,0,0,",414,0,clrBlue);
return(b);
}
//+------------------------------------------------------------------+
//| User-defined function for determining the price of the first order (buy) |
//+------------------------------------------------------------------+
double My_Fun_p()
{
double pb=0;
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)==true)
if(OrderMagicNumber()==414)
{
pb=OrderOpenPrice();
}
return(pb);
}
//+------------------------------------------------------------------+
//| Custom function to open first order (sell) |
//+------------------------------------------------------------------+
int My_Fun_s(double priceb)
{
s=OrderSend(_Symbol,1,0.01,priceb,0,0,",0,0,clrRed);
return(b);
}
//+------------------------------------------------------------------+
Well, you should have specified... The principle is the same
You can also use CopyTime()...
No... It's a little different.
Thank you, it worked. Correct variant:
(TimeCurrent() - (datetime) SeriesInfoInteger (NULL , PERIOD_M5 , SERIES_LASTBAR_DATE))>290
Thanks again, now we can remove mountains of code and use this line!!! ))
Thank you, it worked. Correct variant :
(TimeCurrent() - (datetime) SeriesInfoInteger (NULL , PERIOD_M5 , SERIES_LASTBAR_DATE))>290
Thanks again, now we can remove mountains of code and use this line!!! ))
Apparently it didn't matter if it was the elapsed time from the bar opening or the time to the end of the bar. This variant will give exactly the elapsed time from the start of the bar and not the time to the end of the bar.
And what is the number 290? Why do we need to check for more than 290?
Apparently it didn't matter if it was the elapsed time from the start of the bar or the time to the end of the bar. This option would give exactly the elapsed time from the start of the bar, not the time to the end of the bar.
What is the number 290? Why do we need to check for more than 290?
Compile Error (2): Magic - undeclared identifier
Please help me to correct
bool CheckExists(int Type)
{
bool Result = True;
for(int i = 0; i < OrdersTotal(); i++)
if(OrderSelect(i, SELECT_BY_POS))
if(OrderType() == Type && OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
if(OrderOpenTime() >= Time[0])
Result = False;
for(i = 0; i < OrdersHistoryTotal(); i++)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
if(OrderType() == Type &&& OrderOpenTime() >= Time[0]
&& OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
Result = False;
}
return(Result);
}
Please help me, I can't find an answer to a simple question.
intTimeSeconds(,,,,,)Returns the number of seconds elapsed since the beginning of the minute of the specified time.
If I insert the bar open time into the function
TimeSeconds(iTime(NULL,PERIOD_M5,0))
how can I know that there is 10 seconds left before the bar closes?