[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 59

 
dzhini:
Well...., please, PROFI, give me an answer, what to do with the indicator. Tell me, is it possible or impossible? (The question was written earlier in the thread, if I duplicate it, I will have a second yellow :o) )

You need to bump up the history.

With Alpari it is no problem. Other brokers have problems. I don't remember which ones (moreover it is accepted not to talk about them here on a forum).

 
OrdersTotal<br / translate="no"> int OrdersTotal()
Returns the total number of open and pending orders.

Is it possible to know the total number of open orders only?
 
gince:

You need to bump up the history.

With Alpari it is no problem. Other brokers have problems. I don't remember which ones (moreover it is accepted not to talk about them here on the forum).

I have enough history since the end of June 2010 (in theory, it should be enough to display January 2011). But even that doesn't work. There is some fundamental point in the compatibility of indicator commands and tester operation.
 
Jaguar1974:
Is it possible to know the total number of open orders only?
 int Opend(){
     int Ord=0;
     for(int cnt=0;cnt<OrdersTotal();cnt++){
        if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==true){
          if(OrderMagicNumber()==Magic){
            if(OrderSymbol()==Symbol()){
              if(OrderType()<2)Ord++;
      } } } }        
  return(Ord);} 
 
Good afternoon! Help solve a problem. I have an e-CrossCCI Expert Advisor (not mine). The Expert Advisor works when the indicator line of CCI crosses a zero level, how it works (profitable or not is not the point). And it works with both built-in and with custom indicators. There is a Premier stochastic indicator. In my Expert Advisor, I change the CCI indicator to Premier stochastic, actually leaving the code unchanged (the principle of the same zero crossing). I put it for testing. It does not place any orders. What may be the problem? Everything is attached. The result of problem solving, if possible, please see ban_61@mail.ru/.

Thanks in advance!!!
Files:
123.rar  4 kb
 
ban61:
Good afternoon! Help solve a problem. I have an e-CrossCCI Expert Advisor (not mine). The Expert Advisor works when the indicator line of CCI crosses a zero level, how it works (profitable or not is not the point). And it works with both built-in and with custom indicators. There is a Premier stochastic indicator. In my Expert Advisor, I change the CCI indicator to Premier stochastic, actually leaving the code unchanged (the principle of the same zero crossing). I put it for testing. It does not place any orders. What may be the problem? Everything is attached. The result of problem solving, if possible, please see ban_61@mail.ru/.

Thanks in advance!!!
have you tried figuring out how the indicator buffers work? Very useful article (https://docs.mql4.com/ru/indicators/iCustom)
 
dzhini:
have you tried to figure out how indicator buffers work? Very useful article (https://docs.mql4.com/ru/indicators/iCustom)

I read the article. Premier stochastic indicator seems to be prescribed correctly too, added input parameters:

extern int StochasticLenght=8;

extern int StochasticMode=0;

extern int SmoothLength=25;

extern double Level1=0.9;

extern double Level2=0.2;

the indicator is written

double cci = iCustom(NULL,0, "Premier stochastic",StochasticLenght,StochasticMode,SmoothLength,Level1,Level2,0,1);

double cci1 = iCustom(NULL,0, "Premier stochastic",StochasticLenght,StochasticMode,SmoothLength,Level1,Level2,0,2);

the rest of the source code remains unchanged.

-

-

 
ban61:

I read the article. Premier stochastic indicator seems to be prescribed correctly too, added input parameters:

extern int StochasticLenght=8;

extern int StochasticMode=0;

extern int SmoothLength=25;

extern double Level1=0.9;

extern double Level2=0.2;

the indicator is written

double cci = iCustom(NULL,0, "Premier stochastic",StochasticLenght,StochasticMode,SmoothLength,Level1,Level2,0,1);

double cci1 = iCustom(NULL,0, "Premier stochastic",StochasticLenght,StochasticMode,SmoothLength,Level1,Level2,0,2);

the rest of the source code remains unchanged.

-

-

Question: do you want to learn how to program or just to have your bot fixed? If the first, then you need to understand why the order execution occurs. If it's the second, you should have said so right away...

As for your code, it takes data from the same buffer (of which there are 5) on the previous and the one before the previous candle, and waits for these conditions: (cci1<0 && cci>0) or (cci1>0 && cci<0) .... and I think it will wait forever.

 
Please someone look at my previous question. I can't identify and fix the error. The code compiles, but on the tester it doesn't give the expected result.
 

Hi all!

I have a simple question.

There is a small program, it consists of three files:

1. expert vol1, the file which contains int start () etc.

#include <Variables.mq4>
#import "statistics.mq4"
#import "files.mq4"

int init_main (double &MAIN[], int quantity);
int write (int fh);
int init()
  {  
   return(0);
  }
int deinit()
  {
   return(0);
  }
int start()
  {
  
  init_main(MAIN,50000);
for (int i = 0; i < 1000; i++){
int fh = write(Name);
}
   return(0);
  }

As you can see, I include #include <Variables.mq4>
and import #import "statistics.mq4", #import "files.mq4 ".

2. Variables.mq4 - it contains variables.

string  Name = "new";
double MAIN [50000];
double TEN [10];
double CUR [10];
3. files.mq4 this vile contains several functions

int init_main (double &MAIN[], int quantity){

int count = 0;
int time = 0;
int end_time = 0;

time = TimeCurrent();

end_time = time + quantity;


while (time != end_time){

MAIN[count] = Ask;

Alert(MAIN[count]);

count++;

time = TimeCurrent();

while (time == TimeCurrent()){}

}
}

int write (int fh){ 

if (fh <  0){
     
     Alert("Неудается открыть файл с таким именем, ошибка ", GetLastError() );
     FileClose(fh);
                  }
     
                      
                      if (fh > 0) {

                      //Alert("Записываю тики в файл ", file_name, " !");
                      //Alert(StrToInteger(CharToStr(StringGetChar(file_name,0))));
                     
                 
                 
               
                      FileSeek(fh, 0, SEEK_END);
                      FileWrite(fh, TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS), " ", Ask, " ", Bid);
                      FileClose(fh);
                      return;

            }  
}
The essence of the problem is that the compiler gives me 'MAIN' - variable not defined and

Name' - variable not defined !

I have declared them as Variables.mq4 ?

If someone can help me, I will be very grateful!

Thanks in advance for the reply !