[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 655

 
Vinin:

Naturally, and when else.


mm, I thought, chunks of completed, well, there are 128 kilobytes merged - recorded. As it would be more correct in case of crash. Although for the story, of course, whatever.

I just couldn't figure it out, I was downloading, but there was nowhere to go until I closed the terminal ))

 
ToLik_SRGV
Thanks for the tip on Print(), I'll look into it.
 
sanyooooook:

You can change this parameter in the inite, but in the start it is doubtful.


Thank you, because when the TF on the window changes, the indicator restarts, it means it is possible to re-color the buffers

And the point is - on any TF, the colour of lines corresponding to stochastics of other TFs is always the same colour. I.e. if the hourly stochastic is blue, let it be blue on all TFs.

Of course, we can assign buffers of the appropriate colour to the appropriate TF, but then the processing program becomes more complicated. And we want it to read one and the same buffer under all conditions.

 
ToLik_SRGV:

Print() you need to put here first:

that, make sure that array c1b_1[i] is empty, so comparing in if zeros, understandably deals are not opened.

And zeros there because the averaging period in function iMAOnArray(c1b,0,AvgB,0,MODE_SMA,i) (extern int AvgB=25;) is larger than the array c1b itself , ArrayResize(c1b,PeriodB ) (extern int PeriodB=20;), so it cannot average anything.


Yes, indeed "0", but what to do, tell me - it does not work both ways (and equal periods set) tried both options (new and old) Print("NormalizeDouble(c1b_1 ..., null returns (shows only c1b[i] value, all others including c1s[i] - zeros), help bring one of the options to a working state or at least share a hint, who will see the flaw?

New:

// Торговые критерии   
   double c1b[];
   ArrayResize(c1b,PeriodB);
   double c1b_1[];
   ArrayResize(c1b_1,AvgB);
   for(i=1;i<=PeriodB;i++)
   {
   c1b[i]=iCCI(NULL,0,PeriodB,PRICE_TYPICAL,i);
   {
   c1b_1[i]=iMAOnArray(c1b,0,AvgB,0,MODE_SMA,i);
   }
   }
   
   double c1s[];
   ArrayResize(c1s,PeriodS);
   double c1s_1[];
   ArrayResize(c1s_1,AvgS);
   for(i=1;i<=PeriodS;i++)
   {
   c1s[i]=iCCI(NULL,0,PeriodS,PRICE_TYPICAL,i);
   {
   c1s_1[i]=iMAOnArray(c1s,0,AvgS,0,MODE_SMA,i);
   }
   }
   
   Print("NormalizeDouble(c1b_1[i],4) - ",NormalizeDouble(c1b_1[i],4));
   Print("NormalizeDouble(c1b_1[i+2],4) - ",NormalizeDouble(c1b_1[i+2],4));
   Print("NormalizeDouble(c1b_1[i+3],4) - ",NormalizeDouble(c1b_1[i+3],4)); 

if (NormalizeDouble(c1b_1[i],4)<NormalizeDouble(c1b_1[i+2],4)&&NormalizeDouble(c1b_1[i+2],4)>NormalizeDouble(c1b_1[i+3],4))
     {                                          // 
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
if (NormalizeDouble(c1s_1[i],4)>NormalizeDouble(c1s_1[i+2],4)&&NormalizeDouble(c1s_1[i+2],4)<NormalizeDouble(c1s_1[i+3],4))
     {                                          // 
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }

Old:

// Торговые критерии
   double c1b[];
   ArrayResize(c1b,PeriodB);
   for(i=1;i<=PeriodB;i++)
   {
   c1b[i]=iCCI(NULL,0,PeriodB,PRICE_TYPICAL,i);
   }
   double c1b_1=iMAOnArray(c1b,0,AvgB,0,MODE_SMA,1);
   double c1b_2=iMAOnArray(c1b,0,AvgB,0,MODE_SMA,2);
   double c1b_3=iMAOnArray(c1b,0,AvgB,0,MODE_SMA,3);
   
   double c1s[];
   ArrayResize(c1s,PeriodS);
   for(i=1;i<=PeriodS;i++)
   {
   c1s[i]=iCCI(NULL,0,PeriodS,PRICE_TYPICAL,i);
   }
   double c1s_1=iMAOnArray(c1s,0,AvgS,0,MODE_SMA,1);
   double c1s_2=iMAOnArray(c1s,0,AvgS,0,MODE_SMA,2);
   double c1s_3=iMAOnArray(c1s,0,AvgS,0,MODE_SMA,3);
   
   Print("NormalizeDouble(c1b_1,4) - ",NormalizeDouble(c1b_1,4));
   Print("NormalizeDouble(c1b_2,4) - ",NormalizeDouble(c1b_2,4));
   Print("NormalizeDouble(c1b_3,4) - ",NormalizeDouble(c1b_3,4));

if (NormalizeDouble(c1b_1,4)<NormalizeDouble(c1b_2,4)&&NormalizeDouble(c1b_2,4)>NormalizeDouble(c1b_3,4))
     {
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
if (NormalizeDouble(c1s_1,4)>NormalizeDouble(c1s_2,4)&&NormalizeDouble(c1s_2,4)<NormalizeDouble(c1s_3,4))
     {
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }

Entire:

Files:
21_1.mq4  15 kb
 

Gentlemen, I am wondering, if I cycle through four timeframes to find a signal, will the data be called each time, with more CPU load than if there were, for example, four windows of the same indicator with different timeframes?

 
Rossi:

Gentlemen, I am wondering, if I loop through four timeframes to find the signal, will the data be called each time, with more CPU load than if there were, for example, four windows of the same indicator with different timeframes?


It depends on how it is implemented.
 

int TimeMassive[15, 30, 60, 240] ;

for(int k=0; k<4; K++)

{

timeframe= TimeMassive[k] ;

for(int i=0; i<limit; i++)

Buffer[i]= iMA(NULL, timeframe,..........................) ;

}

approximately like this without allocating memory for each timeframe

 
The same.
 
Rossi:

int TimeMassive[15, 30, 60, 240] ;

for(int k=0; k<4; K++)

{

timeframe= TimeMassive[k] ;

for(int i=0; i<limit; i++)

Buffer[i]= iMA(NULL, timeframe,..........................) ;

}

approximately like this without allocating memory for each timeframe


int TimeMassive[]={15, 30, 60, 240} ;

for(int k=0; k<4; K++)

{

timeframe= TimeMassive[k] ;

for(int i=0; i<limit; i++)

Buffer[i]= iMA(NULL, timeframe,..........................) ;

}
That's a bit more accurate
 
What can cause a stack overflow? When you open a position with a large take (take is calculated from volatility and multiplied by 100, the size is 41*100), a stack overflow is logged and... ... just take it. No more positions are opened until this one closes, and this one, of course, will not close because of the huge TP... And the EA does not work correctly at all, because it should close all positions when the predefined total profit of the open positions is reached... But it doesn't happen, even though this one position has been in huge profit for a long time, about two thousand points... How do I fight it? You cannot be secured against the situation when open positions overflow the stack, and everything goes upside down...
Reason: