Page 98 of 158

Re: Coding Help

Posted: Wed May 08, 2019 3:18 am
by traderduke
mrtools wrote: Wed May 08, 2019 2:19 am

Try this one.
Thank you very much.
Gee all I had to do was re-write the dam thing, HA HA HA. So much for copy and paste.
appreciate it.
Ray

Re: Coding Help

Posted: Wed May 15, 2019 4:08 am
by andrewocconer
Hi guys,
I have this candle body indicator and i want add two buffers, the code is simple and I tried but my knowledge about programming is poor
Can someone do that?
Thanks!

Re: Coding Help

Posted: Wed May 15, 2019 6:24 am
by pacois
andrewocconer wrote: Wed May 15, 2019 4:08 am Hi guys,
I have this candle body indicator and i want add two buffers, the code is simple and I tried but my knowledge about programming is poor
Can someone do that?
Thanks!
Hi, the indicator has 2 buffers, I hope you find it useful.

Re: Coding Help

Posted: Thu May 23, 2019 7:09 pm
by TEAMTRADER
I tried to change the setting of the arrow index to 119 (diamond shape) - so that it is closer to the price as the 'X' goes off screen.
Could someone change this for me please?
Thanks
TEAMTRADER

Re: Coding Help

Posted: Thu May 23, 2019 9:27 pm
by pacois
TEAMTRADER wrote: Thu May 23, 2019 7:09 pm I tried to change the setting of the arrow index to 119 (diamond shape) - so that it is closer to the price as the 'X' goes off screen.
Could someone change this for me please?
Thanks
TEAMTRADER
Try

Re: Coding Help

Posted: Fri May 24, 2019 1:33 am
by TEAMTRADER
pacois wrote: Thu May 23, 2019 9:27 pm

Try
Thanks - I have tried to change the size to 12 but again the code will not accept the change - could you apply this setting. Is there a reason why this indicator will not accept simple changes?
Thanks again Pacois.
TEAMTRADER

Re: Coding Help

Posted: Fri May 24, 2019 3:27 pm
by rohness
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

Re: Coding Help

Posted: Thu May 30, 2019 4:18 am
by gianvito_11
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);
  }


Re: Coding Help

Posted: Fri May 31, 2019 7:03 pm
by kate682
I've jiggled with this code but have been unable to make it show just outstanding positions, (currently it shows outstanding and old positions). Would really appreciate someone helping me to amend it, or pointing me in the right direction. I'm gradually teaching myself coding on a 'need' basis, but lack huge areas grrr.
Regards
Kate

Re: Coding Help

Posted: Sat Jun 15, 2019 5:29 am
by traderduke
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
}