Re: Coding Help

977
How are you, people?
I must say that I am learning to program,
and then I have a question?

Is it possible to visualize the buffers of a shorter timeframe in a longer timeframe, you already know how to see 5m in H1?

since I tried to program it with the bettervolume chartbars part1 1.5 indicator, but I got different data than I expected,

You can check it out and tell me what I did, and what I could do so that it can be visualized and finished.

Thank you

CodeRe: Coding Help

978
Hi guys I have a problem with a indicator in mt4..
i want create
if a standard deviation is < of Average of standard deviation
{
Indicator =1
count ++
}
after 10 bar change color

i add a picture of indicator
and this is code but not work please help me thanks

I need is function in visual and for expert


THANKS YOU SO MUCH

Code: Select all

#property strict

#property indicator_separate_window
#property  indicator_buffers 2
#property indicator_color1 clrYellow
#property indicator_color2 clrRed
#property indicator_maximum 1
#property indicator_minimum 0
//---- input parameters
extern int Periodo = 20;
extern int Periodo_Media = 50;
extern int Divisore_ATRD1 = 3;
extern int numero_consecutivo_barre=3;


//---- buffers
double devstd[];
double media[];
double IndicatorBuffer[];
double atr[];
double band_dist[];
double SqueezeCount[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(6);
   SetIndexBuffer(0,IndicatorBuffer);
   SetIndexBuffer(1,SqueezeCount);
   SetIndexBuffer(5, devstd);
   SetIndexBuffer(2, media);
     SetIndexBuffer(3, atr);
   SetIndexBuffer(4, band_dist);
   
   SetIndexStyle(0, DRAW_HISTOGRAM,0,5);       //Set the style of our indicator 
  // SetIndexArrow(0,174);               //Sets the icon for our indicator
   SetIndexEmptyValue(0,0);            //Sets default empty value
   SetIndexLabel(0,"Squeeze");    
   
   
    SetIndexStyle(1, DRAW_HISTOGRAM,0,5);       //Set the style of our indicator 
  // SetIndexArrow(0,174);               //Sets the icon for our indicator
   SetIndexEmptyValue(1,0);            //Sets default empty value
   SetIndexLabel(1,"Squeeze"); 
   
   SetIndexDrawBegin(0, Periodo + Periodo_Media);
   IndicatorShortName("Squeze ( Periodo std " + IntegerToString(Periodo) + ", Periodo Media " + DoubleToStr(Periodo_Media)  + ")");

   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
 static datetime time = Time[0];
 
 int count=0;
int start()
  {
     /* int counted_bars=IndicatorCounted();
      if(counted_bars < 0) return(-1);
      if(counted_bars>0) counted_bars--;
         int limit = MathMin(Bars-counted_bars,Bars-1);
 
   //
    
      for(int i = limit; i >= 0; i--)
      */
      
        int counted_bars=IndicatorCounted(),
       limit;
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
  
   for(int i=0;i<limit;i++)
       {
  
       devstd[i]=iStdDev(Symbol(),0,Periodo,0,MODE_LWMA,PRICE_WEIGHTED,i);
      
       
       media[i]=iMAOnArray(devstd,0,Periodo_Media,0,MODE_EMA,i);
       
       
       atr[i]=iATR(Symbol(),PERIOD_D1,50,i)/Divisore_ATRD1;///Divisore_ATRD1
      
       band_dist[i]= MathAbs(iBands(Symbol(),0,Periodo,2,0,PRICE_CLOSE,MODE_UPPER,i)-iBands(Symbol(),0,Periodo,2,0,PRICE_CLOSE,MODE_LOWER,i));
       
       if(media[i] != EMPTY_VALUE && media[i]>devstd[i] &&  band_dist[i]<atr[i]){
       //Comment(iBars(Symbol(),0));
       IndicatorBuffer[i]=1;
       
       
       
       

         if(Time[i] > time)//>
       {
         time = Time[i]; //newbar, update time
         Print(time);
         
          
          count++;
       Comment(count);
       if(count>numero_consecutivo_barre) SqueezeCount[i]=1;
        
       } 
       
       
        
       
       
       
       
       
       
      }
      else{
      count=0;
      }
      
      
      
     }
 
   return(0);
  }

Attachments

Re: Coding Help

980
MrTools
I can't seem to clear this warning "Expression not Boolean" on line #354 which is "return(0);" I tried putting true in their but that screwed everything up. I went up on mql5 website but nothing I saw addressed this situation. This of course is a Renko EA.

See below;

Can you please give it a look and suggest the correct answer.

Thank you
Ray
{
if(UseSlowMa)
{
ReadIndicatorValues();
if(CandleIn == 1 )
{if(Open[1] < Close[1]
&& Close[1] > slowestMA
&& TimeCondition())
return(true); return(false);}

else if(CandleIn == 2)
{if(Open[1] < Close[1] &&
Open[2] < Close[2]
&& Close[1] > slowestMA
&& TimeCondition())
return(true); return(false);}

else if(CandleIn == 3)
{if (Open[1] < Close[1] &&
Open[2] < Close[2] &&
Open[3] < Close[3]
&& Close[1] > slowestMA
&& TimeCondition()) return(true); return(false);}

else if(CandleIn == 4)
{if (Open[1] < Close[1] &&
Open[2] < Close[2] &&
Open[3] < Close[3] &&
Open[4] < Close[4]
&& Close[1] > slowestMA
&& TimeCondition()) return(true); return(false);}

else if(CandleIn == 0 || CandleIn > 4)
{if(Open[1] < Close[1]
&& Close[1] > slowestMA
&& TimeCondition())
return(true); return(false);}
}
return (0) ; //need new expression
}


Who is online

Users browsing this forum: No registered users and 12 guests