Jump to content

Indicator that draws Horizontal Lines ??


Recommended Posts

Thx Sixer for reply, but NO that indicator is not the kind I want.

 

In the indicator you have recommended I cannot choose the distance between the horizontal lines.

 

I want an indicator which draws horizontal lines above n below a price level given by me and each line should be separated by same difference in pips, which would also be specified by me.

Edited by devils_advocate
Link to comment
Share on other sites

//+------------------------------------------------------------------+

//| quick draw.mq4 |

//| .....h |

//| hayseedville.com |

//+------------------------------------------------------------------+

#property copyright ".....h"

#property link "hayseedville.com"

 

#property indicator_chart_window

 

extern double start = 0.0;

extern int pips = 100;

extern int steps = 5;

extern bool DrawUp = true;

extern bool DrawDown = true;

extern color clr = Blue;

 

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

 

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int counted_bars=IndicatorCounted();

//----

int i;

 

if(DrawUp)

{

for(i=0; i<steps;i++)

{

Draw("up"+i,start+pips*i*Point);

}

}

 

if(DrawDown)

{

for(i=0; i<steps;i++)

{

Draw("dn"+i,start-pips*i*Point);

}

}

 

 

 

 

//----

return(0);

}

//+------------------------------------------------------------------+

 

 

void Draw(string name, double level)

{

ObjectDelete(name);

ObjectCreate(name, OBJ_HLINE, 0, 0, level);

ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);

ObjectSet(name, OBJPROP_WIDTH, 2);

ObjectSet(name, OBJPROP_COLOR, clr);

}

Link to comment
Share on other sites

  • 4 years later...

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...