[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 261

 

Guys, what does invalid integer number as parameter 10 for OrderSend function mean and how to fix it?

 
Pyxlik2009:

Guys, what does invalid integer number as parameter 10 for OrderSend function mean and how to fix it?

Please give me a line of code where it occurs

 
Pyxlik2009:

Guys, what does invalid integer number as parameter 10 for OrderSend function mean and how to fix it?


The expiry time should be an integer number.
 
Roll:

The expiry time should be an integer.
I don't even have anything fractional in the settings
 
sergey_r:
Yes, but my order is placed by the close of the bar, while I need the current price. If the current price is lower than the low of the previous bar... If the current price has fallen below the previous one then the order is placed

try this

if (Bid<iLow(NULL, 0, 1)


 
Pyxlik2009:
I don't even have anything fractional in the settings

Refer to the 10th parameter of the above function. Set it to 0.
 
paukas:
There is such a thing as a script. When it's needed, just run it.


The point is not to perform the action once. The point is that running this script, it will read the time of its setting but not the triggered time.

Therefore, the very time of pending order triggering is not saved anywhere in the terminal. I just need to know this time and it would be ideal to use the built-in MQL4 PendingOrderFilledTime() function, if it exists. In this case MT4 itself would monitor pending orders and provide me with ready result.

So, I cannot see any other solution other than using an Expert Advisor or a looped script on a chart. Why do I ask here? Perhaps, someone had a similar problem and solved it elegantly, without an Expert Advisor or a script, using only the means of MQ4.


LazarevDenis:

I don't understand why you're not satisfied with the EA, you seem to be not going to build a complex neural network trading system with self-optimization, you just need to check every tick to see if the pendulum is working and when it is triggered you would get a text message on the screen or audio one or both, the calculator can handle this task, don't worry about computers or you just have writing problems?

I don't have any problems with writing it. I don't want to use an improvised tool to receive information from the terminal. An Expert Advisor is a solution to a problem head-on.

If every task, for which there is no standard MQ4 function, were solved by an Expert Advisor, the terminal would have them. And it is not good to create additional weak links in the chain. When you have a lot of open terminals and each of them needs an EA and checking whether it is there or not, you agree that it is inconvenient and unwise. Writing a check for the EA's attachment and forcing it to run there is the same thing, so why complicate the matter, if perhaps someone has already solved this problem using the combination of existing MQL4 functions?

 
Starting:
...maybe someone has already solved a similar problem with a combination of existing MQL4 functions.
I've read it and do not understand the logic. Suppose the function you need is available, how would you use it? You will have to insert it in an Expert Advisor or in a script anyway.
So, the question is not about the absence of a special function (and you can't thank for every sneeze), but about the complexity of writing a code that meets your requirements.
 
granit77:
I've read it and don't understand the logic. OK, let's say there's a function you need, how will you use it? You will have to insert it into Expert Advisor or a script anyway.
So the question is not about the lack of a special function (and you can't thank for every sneeze), but about the difficulty of writing code that meets your requirements.

The use is simple - I run a script which writes the data of the last closed trade with the earliest open time. The pendants triggered by the script cause confusion in the rows of closed orders. At the moment the script starts, it has nowhere to get the data about the pending orders triggering, since their date of triggering is fixed in the history, not the date of their completion.


A simple example.

Pending order 1 was set on 01.01.2011.

02.01.2011 a market order 2 was opened.

On 03.01.2011 pending order 1 triggered and became market order 1 whose OrderOpenTime() will show 01.01.2011, although it actually became market order on 03.01.2011.

04.01.2011 market order 2 was closed.

05.01.2011 market order 1 was closed.

In the history, the date of 02.01.2011 of market order 2 will be given as the date of opening of the last closed order with the latest open date.

Actually the most recent open date (triggered) of the last closed pending order 1 is 03.01.2011.

That is the question, is it possible to obtain the actual date of order triggering in order to correctly sort the closed orders by their open date without an Expert Advisor monitoring the account?


Imagine you are trading, you have pending orders, set a long time ago. And here you see that some of them triggered, and then closed after some time. But they will be considered by their "shaggy" time of placing, even if they were placed a year ago, but triggered and closed only today. You want to see what was really opened or triggered in the market last, so it would be given last, and not everything that was once mixed up with market ones that were opened really recently. Thank you for your attention to my question.

 

Gentlemen, can you tell me where I made a mistake when I inserted this timing function into my EA code?

int init()
  {
  
bool isTradeTimeInt (int hb=05,int mb=50,int he=23,int me=00) 
    {
  datetime db, de;           // Время начала и окончания работы
  int      hc;               // Часы текущего времени торгового сервера

  db=StrToTime(TimeToStr(TimeCurrent(), TIME_MINUTES)+" "+hb+":"+mb);
  de=StrToTime(TimeToStr(TimeCurrent(), TIME_MINUTES)+" "+he+":"+me);
  hc=TimeHour(TimeCurrent());
  if (db>=de) {
    if (hc>=he) de+=24*60*60; else db-=24*60*60;
  

  if (TimeCurrent()>=db && TimeCurrent()<=de) return(True);
  else return(False);
}
   return(0);
  }

The compiler just flooded me with errors.

Reason: