Re: Coding Help

681
hi guys,

I am trying to code a simple indicator showing the uptick and downtick histo seperately. Unfortunatels it seems it shows only the upticks. This is the code i am using

Code: Select all

#property indicator_separate_window
#property indicator_buffers 2


#property indicator_color1 ForestGreen
#property indicator_color2 OrangeRed




double Uptick[];
double Dntick[];



//+------------------------------------------------------------------+
//| indicator initialization                                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("VolumeDif("+Symbol()+")");
  
   SetIndexBuffer(0,Uptick);
   SetIndexBuffer(1,Dntick);

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

   

  
   
   return(0);
  }
  
//+------------------------------------------------------------------+
//| indicator deinitialization                                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
 
//+------------------------------------------------------------------+
//| indicator function                                               |
//+------------------------------------------------------------------+ 
int start()
  {
   int counted_bars=IndicatorCounted();
   int i,limit;
//----
   if(counted_bars==0)
      limit=Bars-1;
   if(counted_bars>0)
      limit=Bars-counted_bars;
   limit--;
   for(i=limit; i>=0; i--)

         Uptick[i]=(Volume[i]+(Close[i]-Open[i])/Point)/2;
         Dntick[i]=-Volume[i]+(Volume[i]+(Close[i]-Open[i])/Point)/2;
         


//----
   return(0);
  }
//+------------------------------------------------------------------+
can someone please correct the code so that it shows both the histo?
Know Thy Setup. Know Thyself.


Re: Coding Help

683
tayna13 wrote: Fri Apr 13, 2018 4:40 am Is it possible to make the arrow not disappear??
Mq4 format files (not decompiled) required to see the code for any alteration
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.


Re: Coding Help

687
I am trying to plot the number of upticks and downticks in a candle seperately . And I want the value to be updated every tick. Can someone tell me if this commands are alright or if I need to use something else here.

Code: Select all

 
 Uptick[i]=(Volume[i]+(Close[i]-Open[i])/Point)/2;
 Dntick[i]=-Volume[i]+(Volume[i]+(Close[i]-Open[i])/Point)/2;
  
Know Thy Setup. Know Thyself.

Re: Coding Help

688
shaileshm wrote: Tue Apr 17, 2018 3:20 am I am trying to plot the number of upticks and downticks in a candle seperately . And I want the value to be updated every tick. Can someone tell me if this commands are alright or if I need to use something else here.

Code: Select all

 
 Uptick[i]=(Volume[i]+(Close[i]-Open[i])/Point)/2;
 Dntick[i]=-Volume[i]+(Volume[i]+(Close[i]-Open[i])/Point)/2;
  
Maybe something like this

Code: Select all

 upTicks[i] = (Volume[i]+(Close[i]-Open[i])/Point) / 2.0;
  dnTicks[i] = (Volume[i] - upTicks[i]);
  
These users thanked the author mrtools for the post:
shaileshm

Re: Coding Help

690
thiru wrote: Wed Apr 18, 2018 1:13 pm Can someone help to migrate this code to support the new MT builts?

The code looks quite heavy.

thanks in advance


BJF-AdaptiveCyberCycle-3.2.mq4
Try now - 100 plus errors removed and max number of bars reduced from 2000 to 500,if needed reduce more
These users thanked the author mntiwana for the post (total 2):
moey_dw, thiru
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.


Who is online

Users browsing this forum: No registered users and 22 guests