//+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ void start(); int Counted_bars=IndicatorCounted(); int i=Bars-Counted_bars-1; while(i>=0) {
//+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ void start() { int Counted_bars=IndicatorCounted(); int i=Bars-Counted_bars-1; while(i>=0) {You are missing something...
Marco vd Heijden:
You are missing something...
I think so too, but what am I missing
You are missing something...
Rio12:
are you sure its because of the braces ? because here is what I got after i put the braces:
Did you also remove the semicolon?
//+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ void start(); int Counted_bars=IndicatorCounted(); int i=Bars-Counted_bars-1; while(i>=0) {
//+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ void start() { int Counted_bars=IndicatorCounted(); int i=Bars-Counted_bars-1; while(i>=0) {You will also need to check that you have the braces matched
Keith Watford:
Did you also remove the semicolon?
You will also need to check that you have the braces matchedalthough there is no error in the code but the indicator is not drawing any horizontal lines
//+------------------------------------------------------------------+ //| HLine Alert.mq4 | //+------------------------------------------------------------------+ #property indicator_chart_window extern int HOUR = 4; //Hour to draw the lines extern int MINUTE = 0; //Minute to draw the lines extern string LineName="MyLineL"; extern string LineName1="MyLineH"; extern color LineColor=Pink; extern color LineColor1=DodgerBlue; extern int LineStyle=STYLE_SOLID; extern int LineStyle1=STYLE_SOLID; extern int pipDistance = 5; extern string AlertWav="alert.wav"; extern color Line_Color = clrBlack; //Color of the lines input ENUM_LINE_STYLE Line_Style = STYLE_DASH; //Style of the lines string name = "TimeLine"; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ void start() { int Counted_bars=IndicatorCounted(); int i=Bars-Counted_bars-1; while(i>=0) { if(TimeHour(Time[i]) == HOUR && TimeMinute(Time[i]) == MINUTE) { if (ObjectFind(name+DoubleToStr(Time[i])) != 0) { ObjectCreate(name+DoubleToStr(Time[i]), OBJ_HLINE, 0, Low[i], 0); ObjectSet(LineName, OBJPROP_STYLE, LineStyle); ObjectSet(LineName, OBJPROP_COLOR, LineColor); ObjectSetInteger(0,name+DoubleToStr(Time[i]),OBJPROP_STYLE,Line_Style); ObjectSet(name+DoubleToStr(Time[i]), OBJPROP_COLOR, Line_Color); ObjectCreate(LineName1, OBJ_HLINE, 0, High[i], 0); ObjectSet(LineName1, OBJPROP_STYLE, LineStyle1); ObjectSet(LineName1, OBJPROP_COLOR, LineColor1); double val = ObjectGet( LineName, OBJPROP_PRICE1); if (Bid <= val ) PlaySound(AlertWav); double val1 = ObjectGet( LineName1, OBJPROP_PRICE1); if (Bid >= val1 ) PlaySound(AlertWav); } } return(0); } } //+------------------------------------------------------------------+

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello there
i am a total newbie in coding and i dont know anything
so the thing is that i needed an indicator that can draw two horizontal lines at candle high and low , and the candle that lines are drawn at is 01:00 candle
so i did this :
well as expected there were a lot of errors but most of them were syntax error , that i got rid of , only one is remaining , can anybody take a look and tell me if the indicator will do what i intend , and also could you help me with the error
thanks
and sorry for the poor English language , it not my native language so i might have a lot of mistakes