[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 72

 

http://www.soft-sib.ru/articles/programs/10/

Another advantage of using DBMS and client-server architecture over the file-server approach is the possibility to use a transactional data manipulation mechanism. This service, provided by the data server, allows several data modification actions to be combined into one indivisible operation (transaction). The use of transactions ensures reliable protection of information from hardware and software failures on both the client and the server side of the IS.

 
Yeah, either I'm invisible or no one wants to help or can help((
 
PerlOF:


The handbook and tutorial point out the necessity of connecting to a server (for the EA, scripts, indicators).

Is it possible to call special functions without connecting to the server (in principle)?


Yes, it is. The server, in fact, is needed to receive a tick that launches the start() function.

start() - main function. It is called at experts after the receipt of the next tick. For custom indicators it is called during recalculation after attaching the indicator to the chart, at the client terminal opening (if the indicator is attached to the chart), as well as after the coming of the next tick. In scripts it is executed immediately after attaching to the chart and initialization. If there isno start() function in the module, this module (Expert Advisor, script or custom indicator) cannot be launched.

The script can run in an infinite loop, and therefore it doesn't need ticks, ticks are needed for indicators and Expert Advisors (in the standard configuration (because Expert Advisors can also run in an infinite loop)).

But the ticks can be caused artificially - with VINAPI. In addition, there is such a standard feature as the strategy tester (which is also able to generate ticks).

You just need to use your brain and SEARCH ON THE SITE (FORUM).

And not bring in the advantages or disadvantages of file-server technology.

 
MXDEEM:

Hello, I have this code, check for the presence of orders, if I have an open order, then check again and so on, until the order reaches 0. But the expert clearly ignores this code and opens an infinite number of orders, please advise what is the error?

int FunctionBUYnext()
{
int b=OrdersTotal();
if (b>0)
{FunctionBUYnext();}
else {FunctionSELL();}
}



MQL4 Community Forum Navigator
RulesSearchHow to postForum administrationReport abuseTelepath Club
Questions you should not ask
How to ask the right questions
Useful literatureUseful softwareLooking for an Indicator (Expert Advisor or script)
 

There is a need to draw a line in a Trading Expert Advisor using the iCustom function.
I used ZigZag as a test:

for(int cnt=0; cnt<10000; cnt++) {
   double zigzag1=iCustom(NULL,0,"ZigZag",15,0,3,  0,cnt+1);
   if( zigzag1!=0 ) 
      break;
}


Since iCustom's purpose in my case is only to draw a line
(the indicator data is not used in the Expert Advisor ), I decided to put the code in deinit(). But it doesn't work there and draws nothing.
In start(), everything is OK.
1. Why it does not work in deinit()?
2. You need to avoid running the above code senselessly when testing and optimizing
(avoid wasting CPU time) and have it run only on the last bar of the history being tested.
- How can this be achieved?
Thank you!
 
Roll:

code is absurd.

WHY? ALL AS TAUGHT
 
MXDEEM:

WHY ??? ALL AS A TEACHER.

It's strange how you were taught...

Where are the functions called from the body of your "code"?

The "code" itself is pretty funny too...

int FunctionBUYnext()
{
int b=OrdersTotal();
if (b>0)
{FunctionBUYnext();}
else {FunctionSELL();}
} 

Using a call to itself... Why not just exit FunctionBUYnext() when there are no orders ?

Further - no check for order type, no check for symbol and magik...

I would send your "teacher" to the rack...

 

Faced with a problem...

The script works with MessageBox() function in this form

//+------------------------------------------------------------------+

#include <WinUser32.mqh>
#import "user32.dll"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int result = MessageBox("Are you ok?", "Caption",MB_YESNO|MB_ICONQUESTION);
   if(result != IDYES) Alert("Кнопка да не нажата");
//----
   return(0);
  }
//+------------------------------------------------------------------+

But it completely fails when using undocumented MessageBoxTimeoutA() function:

//+------------------------------------------------------------------+

#include <WinUser32.mqh>
#import "user32.dll"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int result = MessageBoxTimeoutA(0, "Are you ok?", "Caption",MB_YESNO|MB_ICONQUESTION, 0, 10000);
   if(result != IDYES) Alert("Кнопка да не нажата");
//----
   return(0);
  }
//+------------------------------------------------------------------+

Even a message window with Yes/No buttons won't show up.

Who encountered it - tell me where the dog is buried?

 
artmedia70:

It's strange how you were taught...

Where are the functions called from the body of your "code"?

The "code" itself is pretty funny too...

Using a call to itself... Why not just exit FunctionBUYnext() when there are no orders ?

Further - no check for order type, no check for symbol and magik...

I would send your "teacher" to the rack...

I EXPLAIN THE MEANING, CALLS ITSELF BECAUSE YOU NEED A CHECK IN THIS PART, IF YOU MAKE A WITHDRAWAL IT WILL RETURN AGAIN TO THE EXECUTION START, I DO NOT NEED IT, THE SYMBOL AND MAGICIAN ARE NOT CONSIDERED, MY TEACHER INTERNET)))) IF IT IS NOT DIFFICULT PLEASE SEND ME SOMETHING SIMILAR BUT WORKING, THE MAIN IDEA - NOT TO LET ON IF THERE IS AN ORDER, IF NOT THEN SKIP TO A SPECIFIC FUNCTION.

 
MXDEEM:

I EXPLAIN THE MEANING, CALLS ITSELF BECAUSE WE NEED A CHECK IN THIS PART, IF YOU EXIT IT WILL RETURN AGAIN TO THE EXECUTION START, I DO NOT NEED IT, THE SYMBOL AND THE MAGICIAN ARE NOT TAKEN INTO ACCOUNT, MY TEACHER INTERNET))) IF YOU DO NOT MIND SENDING SOMETHING SIMILAR BUT WORKING, THE MAIN IDEA - NOT TO LET ON IF THE ORDER, IF NOT, THEN SKIP TO A SPECIFIC FUNCTION.

Oh, do not shout so ... I think you have CapsLock stuck... The font size should be doubled, and it would be bold...

It's just a... an aside.

Now let me explain it to you:

I'll explain the point. By making a recursive call, you are getting your EA to loop exactly to this part... That is, if there are any orders or market positions, the EA should hang and do nothing (just hang) until you manually delete all orders and close positions? Then what is the point of such automated trading, if the EA will hang there without your intervention?

Reconsider your approach to EA logic