Forex Factory (https://www.forexfactory.com/forum.php)
-   Platform Tech (https://www.forexfactory.com/forumdisplay.php?f=69)
-   -   Can u point me to code 2 show each bar with a higher high & higher low? (https://www.forexfactory.com/showthread.php?t=233646)

Pvj Apr 27, 2010 10:02am | Post# 1

Can u point me to code 2 show each bar with a higher high & higher low?
 
Hi - noobie in MT4 coding.

I want to highlight each and every bar that matches my test - for backtesting and future trade identification.

I'm guessing that it should be a script - or should it be something else.

If you could point me to some example code that 'highlights' each bar with a higher high and a higher low than the previous bar (or similar easy example) I think that I could take it from there.

Thankyou for any help.

nightyhawk Apr 27, 2010 2:46pm | Post# 2

PHP Code:
#property indicator_chart_window
#property  indicator_buffers 1
#property  indicator_color1  Gray
#property  indicator_width1  1

double ExtSignalBuffer[]; 
Define indicator!

PHP Code:
int init() {
   
IndicatorDigits(Digits+1);
   
SetIndexStyle(0,DRAW_ARROW);
   
SetIndexBuffer(0,ExtSignalBuffer);
   
SetIndexArrow(0,252); 
  return(
0);

PHP Code:
int start() {
  
int limit;
  
int counted_bars=IndicatorCounted();
  if(
counted_bars>0counted_bars--;
  
limit=Bars-counted_bars;
  
  for (
int i 0i<limiti++) {  
    
ExtSignalBuffer[i] = EMPTY_VALUE;
    
    if (
iHigh(Symbol(), Period(), i) > iHigh(Symbol(), Period(), i+1) &&
        
iLow(Symbol(), Period(), i) > iLow(Symbol(), Period(), i+1)) {
      
ExtSignalBuffer[i] = iLow(Symbol(), Period(), i) - 20*Point;
    }

  }


Pvj Apr 27, 2010 9:01pm | Post# 3

Thankyou nightyhawk.

This works fine - I should be able to take it from here.

Rgds


© Forex Factory