Jump to content

Request code costum indicator


Recommended Posts

at normal market condition last candle close is equal to open for current candle and if you add 1 or 2 pips difference then it would be a very normal bull and bear candle. can you be more specific, ie. volume, wick, candle formation.. etc.

i use arrow instead of line because it easier to see, there would be too many line.

the code

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_color2 White

double EqualOC[], EqualCO[];

int init()
 {
  string sShortName;
  SetIndexBuffer(0,EqualOC);
  SetIndexBuffer(1,EqualCO);

  SetIndexStyle(0,DRAW_ARROW);
  SetIndexArrow(0,116); 
  SetIndexStyle(1,DRAW_ARROW);
  SetIndexArrow(1,116); 

  return(0);
 }


int start()
 {
  int limit;
  int counted_bars=IndicatorCounted();
  if(counted_bars>0) counted_bars--;
  limit=Bars-counted_bars;
  for(int i=0; i<limit; i++)
    {
     EqualOC[i]=0;
     EqualCO[i]=0;
     if(
        (Open[i+1] <= Close[i+1]) && 
        (Close[i+1] == Open[i]) && 
        (Close[i] <= Close[i+1])
       ){EqualOC[i] = High[i];}
       
     if(
        (Open[i+1] >= Close[i+1]) && 
        (Close[i+1] == Open[i]) && 
        (Close[i] >= Close[i+1])
       ){EqualCO[i] = Low[i];}
    }
  return(0);
 }

Link to comment
Share on other sites

the code is working just fine... the only reason is your broker never give you last close equal to open for current bar.. =))

i try it on my 3 different broker, on M15 AUDUSD at In*******x broker, I just get 1 arrow at may 9, 2012 at 21:00, while on Fx**o and I**x just like star sparkling on the sky.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...