[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 50

 
IgorM:

I have already racked my brains, I cannot find an optimal solution for calculations in the indicator:

How to find the bar number on the lower TF where the day begins (or 4 hours) and where the day ends (or 4 hours)?


And iBarShift() does not help?
 

Help me to get currency symbols in one calculation. I did this (below), iClose and iBar return zeros, I understand the problem in symbn="symb" + j. But symbn returns what I need symb1 for example.

What am I doing wrong? How to correctly search currencies in the list?

        int nSymb = 2;
        symb0="EURUSD";
        symb1="GBPUSD";
        
        for (j=0; j<nSymb; j++){
        for (i=0; i<Bars; i++){
                // получаем полуночный бар
                symbn = "symb" + j;
                str = TimeYear(Time[i])+"."+TimeMonth(Time[i])+"."+TimeDay(Time[i]);
                time0 = StrToTime(str);
                bar0=iBarShift(symbn, 0, time0);
                // берем цену закрытия предыдущего дня
                pc=iClose("symb"+j, 0, bar0+1); Content[j][0]=0;
                if (pc!=0) Content[j][0]=(iClose(symbn,0, i )  *100)/pc-100;
 
Vinin: Does iBarShift() no longer help?

I know about iBarShift(), but I use it to determine the start and end of the day:

int start(){
   int    i,limit,counted_bars;
   counted_bars=IndicatorCounted();
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars-1;
   for(i=limit; i>=0; i--){
      if(TimeDay(Time[i]) != TimeDay(Time[i+1])){
            // начался новый день, обнуляю все что нужно
      }else{
            // продолжается текущий день, считаю все что нужно
      }
   }
return(0);
}
The code works in principle, but universality is lost - you can enter conditions for a week/month to calculate, for a new hour as well, but for a new H4 it is already difficult, I would like some univrsality


 
Kondratiev_A_A:

Help me to get currency symbols in one calculation. I did this (below), iClose and iBar return zeros, I understand the problem in symbn="symb" + j. But symbn returns what I need symb1 for example.

What am I doing wrong? How do I make the list of currencies go through correctly?

Different types.

        int nSymb = 2;
        symb0="EURUSD";
        symb1="GBPUSD";
        
        for (j=0; j<nSymb; j++){
        for (i=0; i<Bars; i++){
                // получаем полуночный бар
                symbn = "symb" + j;
                str = TimeYear(Time[i])+"."+TimeMonth(Time[i])+"."+TimeDay(Time[i]);
                time0 = StrToTime(str);
                bar0=iBarShift(symbn, 0, time0);
                // берем цену закрытия предыдущего дня
                pc=iClose("symb"+j, 0, bar0+1); Content[j][0]=0;
                if (pc!=0) Content[j][0]=(iClose(symbn,0, i )  *100)/pc-100;
 
Kondratiev_A_A: How do you do a correct enumeration of currencies in a list?

You need to use arrays, like this:

#define nSymb  2

string symb[nSymb];

symb[0] = "EURUSD";
symb[1] = "GBPUSD";
//................
int start(){
      for (j=0; j<nSymb; j++){
            //................
            bar0=iBarShift(symb[j], 0, time0);
            // берем цену закрытия предыдущего дня
            pc=iClose(symb[j], 0, bar0+1); Content[j][0]=0;
            //................
      }//for
//................
return(0);
}// start()
 
Thank you all for your help, I'm getting to grips with it)!!!
 
The internet often goes down, is there no way to automate it programmatically to get it up and running again? Or what is known in this direction? Is there a way to power up two or more ISPs at the same time, I mean in parallel? Thank you in advance.
 
yosuf:
The internet often goes down, is there no way to automate it programmatically to get it up and running again? Or what is known in this direction? Is there a way to power up two or more ISPs at the same time, I mean in parallel? Thank you in advance.
It is possible to power from two ISPs. One could be a cellular operator, for example.
 
yosuf:
The internet often goes down, is there no way to automate it programmatically to get it up and running again? Or what is known in this direction? Is there a way to power up two or more ISPs at the same time, I mean in parallel? Thank you in advance.
In any case the correct -VPS (and the wrong - a router with 2WAN ports and don't say it's expensive) (from the manufacturer's website - By default, the TL-R470T+ has only two ports configured for WAN mode: port 1 and port 2 are in WAN mode, while ports 3-5 are configured for LAN mode).
 

yosuf


Make yourself a bat file which will check the connection and, if it fails, re-establish it