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

 
Can you please tell me where I can find a code example to colour the indicator line in different colours?
 
Leo59:
Can you please tell me where I can find a code example that paints the indicator line in different colours?
As many colours, as many buffers! If you change the colour you change the buffer! Many examples in CodeBase!
 
How to make an entry on the right line ... in the tht file...
 
borilunad:
As many colours, as many buffers! Provided the colour changes, you change the buffer! Lots of examples in CodeBase!
Thank you.
 
What's wrong? Why are there blue areas left out?
#property  indicator_separate_window
#property  indicator_buffers 3
#property   indicator_color1  Aqua
#property   indicator_width1  1
#property   indicator_color2  Red
#property   indicator_width2  1
#property   indicator_color3  Yellow
#property   indicator_width3  1

extern int       Fperiod=1;
extern int       Speriod=2;
extern int       Method=3;
extern int       PRICE_MODE=PRICE_WEIGHTED;

double   Buf0[];
double   Buf1[];                                
double   Buf2[];                                
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
   {
    SetIndexBuffer(0,Buf0);
    SetIndexBuffer(1,Buf1);
    SetIndexBuffer(2,Buf2);

    SetIndexStyle(0,DRAW_LINE);
    SetIndexStyle(1,DRAW_LINE);
    SetIndexStyle(2,DRAW_LINE);

    SetIndexEmptyValue(1,EMPTY_VALUE);   
    SetIndexEmptyValue(2,EMPTY_VALUE);   

    IndicatorShortName("Proba ");                
   
    SetIndexDrawBegin(0, 0);  
    SetIndexDrawBegin(1, 0);
    SetIndexDrawBegin(2, 0);

    return(0);
   }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
   {
    int i; 
    int limit;
    int counted_bars=IndicatorCounted();
    if(counted_bars<0) return(-1);
    if(counted_bars>0) counted_bars--;
    limit=Bars-counted_bars;
    for (i = limit;i>=0;i--)
        {  
         Buf0[i]=iMA(NULL,0,Fperiod,0,Method,PRICE_MODE,i)-iMA(NULL,0,Speriod,0,Method,PRICE_MODE,i);
         if(Buf0[i] > Buf0[i+1])
             {
              Buf1[i] = Buf0[i];
//              if(Buf0[i+1] > Buf0[i+2])
//                   Buf1[i+1] = Buf0[i+1];
//              else Buf2[i+1] = Buf0[i+1];
             }
         else
             {
              Buf2[i] = Buf0[i];
//              if(Buf0[i+1] < Buf0[i+2])
//                   Buf2[i+1] = Buf0[i+1];
//              else Buf1[i+1] = Buf0[i+1];
             }
        }              
    return(0);
   }


 
Is it possible to link three charts with different timeframes in the EA? Based on the indicator readings in two charts, a place and currency pair to enter is found, and based on the last third chart, the entry, stop and profit are calculated, and a position is opened for entry. Is this technically possible? Or do you need to create an Expert Advisor specifically for a certain timeframe to work in one chart? This requires not only counting the readings of bars, ticks or candlesticks from charts of different timeframes, but also analyzing the readings of at least two indicators and opening an order based on these data.
 
I was writing a function for detecting flytrap and got stuck in something that I do not understand. if statement does not work. maybe I wrote something wrong somewhere, I want you to take a fresh look, because I do not understand why. I even recorded a video from the debugger, where I show that the values are equal, but it does not work. please put my brain in place))))
{
      int size = ArrayRange(arrayMinLow,0);
      int digits = MarketInfo (symbol,MODE_DIGITS);
      
      double spreadFlat = highLine - lowLine;
      
     
      int directionFlat = -1;
      int slew = 0;
      for (int i = 0; i<size; i++){
            double hl =arrayMinLow[i][0];
            double ol = arrayMinLow[i][1];
            double cl = arrayMinLow[i][2];
            double ll = arrayMinLow[i][3];
            
            if (hl == highLine || ol == highLine){                                      //вот тут не срабатывает

                  if( directionFlat == -1 || directionFlat == 0)
                        slew++;

                  directionFlat = 1;
            }else if  (cl == lowLine|| ll ==lowLine){
               
                  if( directionFlat == -1 || directionFlat == 1)
                        slew++;               
               
                  directionFlat = 0;
               
           }
                  
      
      }
      
      if(slew >=4 )
         return true;
         
      return false;   
      
      

}




video link https://www.youtube.com/watch?v=k9Zo0SgrMCA
 
Deniskaaa:
Is it possible to link three charts with different timeframes in the EA? Based on the indicator readings in two charts, a place and currency pair to enter is found, and based on the last third chart, an entry point, stop and profit are calculated, and a position is opened for entry. Is this technically possible? Or do you need to create an Expert Advisor specifically for a certain timeframe to work in one chart? We should not only count the readings of bars, ticks or candlesticks from charts of different timeframes, but analyze the readings of at least two indicators and open an order based on the third one.
Everything is possible! See documentation or help in MetaEditor!
 
pycha:

Hello, I was writing a function for detecting flytags and got stuck in something that I do not understand. if statement does not work. maybe I wrote something wrong somewhere, I want you to take a fresh look, because I do not understand why. I even recorded a video from the debugger, showing that the values are equal, but it does not work. please put my brain in the place of))))


code:

bool  checkLine(double highLine , double lowLine, double &arrayMinLow[][5] )
{
      int size = ArrayRange(arrayMinLow,0);
      int digits = MarketInfo (symbol,MODE_DIGITS);
      
      double spreadFlat = highLine - lowLine;
      
     
      int directionFlat = -1;
      int slew = 0;
      for (int i = 0; i<size; i++){
            double hl =arrayMinLow[i][0];
            double ol = arrayMinLow[i][1];
            double cl = arrayMinLow[i][2];
            double ll = arrayMinLow[i][3];
            
            if (hl == highLine || ol == highLine){                                      //вот тут не срабатывает

                  if( directionFlat == -1 || directionFlat == 0)
                        slew++;

                  directionFlat = 1;
            }else if  (cl == lowLine|| ll ==lowLine){
               
                  if( directionFlat == -1 || directionFlat == 1)
                        slew++;               
               
                  directionFlat = 0;
               
           }
                  
      
      }
      
      if(slew >=4 )
         return true;
         
      return false;   
      
      

}





Use the SRC button to paste the code, not the picture! Ask the author of this idea and video for advice!
 
If it makes things easier, I'll re-post it correctly. i've written a function for detecting flytags and i stumbled in something that i don't understand. if statement does not work. maybe i wrote something wrong somewhere, i want you to take a fresh look, i don't understand why. i even recorded a debugger video showing equaling values, but it does not work. please put my brain back into))))
{
      int size = ArrayRange(arrayMinLow,0);
     
      
      double spreadFlat = highLine - lowLine;
      
     
      int directionFlat = -1;
      int slew = 0;
      for (int i = 0; i<size; i++){
            double hl =arrayMinLow[i][0];
            double ol = arrayMinLow[i][1];
            double cl = arrayMinLow[i][2];
            double ll = arrayMinLow[i][3];
            
            if (hl == highLine || ol == highLine){                                      //вот тут не срабатывает

                  if( directionFlat == -1 || directionFlat == 0)
                        slew++;

                  directionFlat = 1;
            }else if  (cl == lowLine|| ll ==lowLine){
               
                  if( directionFlat == -1 || directionFlat == 1)
                        slew++;               
               
                  directionFlat = 0;
               
           }
                  
      
      }
      
      if(slew >=4 )
         return true;
         
      return false;   
      
      

}




video link https://www.youtube.com/watch?v=k9Zo0SgrMCA



I can't delete the previous post, I copied everything into html and removed the tag I need to edit the post

Reason: