Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 253

 
ALXIMIKS:
Insert at the end of the custom macdac.

P.S. Although it's truer and better:


if so, it doesn't work....

double MACDBuffer[];
double SignalBuffer[];

 
 int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      MACDBuffer[i]=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,26,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer[i]=iMAOnArray(MACDBuffer,Bars,9,0,MODE_SMA,i);
        //t=MACDBuffer[0];
        //Print(t*10000);
//---- done
  
  
int max,min;
   static double maxlast,minlast;
   max = ArrayMaximum(MACDBuffer,20,1);
   min = ArrayMinimum(MACDBuffer,20,1);
   if (MACDBuffer[max]!=maxlast){
      maxlast=MACDBuffer[max];
      ObjectDelete  ("highline");   
      ObjectCreate ("highline",1,WindowOnDropped( ) ,0,MACDBuffer[max],0,0);
   }
   if (MACDBuffer[min]!=minlast){
      minlast=MACDBuffer[min];
      ObjectDelete  ("lowline");   
      ObjectCreate ("lowline",1,WindowOnDropped( ) ,0,MACDBuffer[min],0,0);
      Print(min,max);
   }
    return(0);
  }
 
artmedia70:
Copy your required MACD data to array massMACD[20] and find in this array
minimum ArrayMinimum(massMACD); and
the maximum ArrayMaximum(massMACD); values.


fine.

the only question is HOW do they copy the data into the array?

for(int i=1; i<20; i++)
      MACDBuffer[i]=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,26,0,MODE_EMA,PRICE_CLOSE,i);

or like this?

   MACDLineBuffer[i] = iMACD(NULL, 0, 12,26,9,PRICE_CLOSE,MODE_MAIN,i);
 
lottamer:


if so, it doesn't work....

At the end of the custom MACD:

Navigator ==> Custom Indicators ==> MACD ==> PCM (right mouse button) ==> Edit ==>

 
lottamer:


great.

the only question is HOW do they copy the data into the array?

or like this?


man, it's the same thing, it's just not the fact that calling iMACD takes as many resources as its source code.

iMACD and all iCostums return the value of an array member, so you need to loop through and collect them in a buffer for further op

  MACDLineBuffer[i] = iMACD(NULL, 0, 12,26,9,PRICE_CLOSE,MODE_MAIN,i);

not true, because you only get one value and you need 20, so use a loop:

for(int i=1; i<20; i++)
      MACDLineBuffer[i] = iMACD(NULL, 0, 12,26,9,PRICE_CLOSE,MODE_MAIN,i);

 
ALXIMIKS:

At the end of the custom MACD:

Navigator ==> Custom Indicators ==> MACD ==> PCM (right mouse button) ==> Edit ==>

it works :)

Only it certainly doesn't do what I need it to do, but I'll try to make use of it as an example.

thanks

 

let's start from the beginning.

int start()
  {
  
    
for(int i=0; i<20; i++)
MACDBuffer[i] = iMACD(NULL, 0, 12,26,9,PRICE_CLOSE,MODE_MAIN,i);

is this enough to copy 20(19 whatever) indicator values into an array?

 
lottamer:

let's start from the beginning.

is it enough to copy 20(19 whatever) indicator values into an array?

Let's be clear, if someone needs something and I know something - I'm happy to try to help that person,

but I'm not going to wipe their ass after every fart.

Yes, it's enough if you declared static array double MACDBuffer[20] and not enough if you declared dynamic array double MACDBuffer[].

artmedia70 told you that .

 
ALXIMIKS:

Let's be clear, if someone needs something and I know something, I am happy to try to help that person,

But I'm not going to wipe his ass after every fart.

Yes, it's enough if you declared static array double MACDBuffer[20] and not enough if you declared dynamic array double MACDBuffer[].

artmedia70 told you that .


OK, let's make it static.

double MACDBuffer[20];

double min,max;
 
  
 int start()
  {
 
   for(int i=0; i<20; i++)
      MACDBuffer[i]=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,26,0,MODE_EMA,PRICE_CLOSE,i);

   min=ArrayMinimum(MACDBuffer);
   max=ArrayMaximum(MACDBuffer);
  
  Print(min,"____",max);

why does it print 19__0 ???

 
lottamer:


ok, let it be static.

why does it print 19__0 ???


because it works right. Anything else?
 

When reading file from .txt terminal outputs lines with the following content "Рконмическй каР"ендарь - РђРЅРРР° СЂС'РЅРєР°" all Russian letters, latin and other symbols outputs normally. The problem is that the terminal can not do a search for Russian letters, because it takes them as symbols. The problem is the need to translate data from .txt into strings and search for the right information, followed by the correct output.

What variants of treatment of this problem exist?

Reason: