Change | bool back=false; |
to | bool back=true; |
Hi, William. Could you please help me again with MT4, by removing the grid values on Vertical price, just like what you helped me on MT5?
***I've tried to do something to remove the value but unsolved. I have no knowledge of coding at all.
He did help and it was logical — If you remove both the horizontal and vertical lines, then you might as well remove the indicator itself.
If that is not what you are asking, then please explain in more detail, or else we will end up misunderstanding your request.
Its the same function for MT4
i tried to use the OBJPROP_PRICE_SCALE but it does not appear to be responding , on mt4 .
So the solution is Williams original point The back property .
//+------------------------------------------------------------------+ //| Horizontal_Grid_Lines.mq4 | //| Copyright 2015, MetaQuotes Software Corp. | //| http://www.mql5.com | //| Edits and Improvements: File45 | //| https://www.mql5.com/en/users/file45/publications | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "3.00" #property strict #property indicator_chart_window //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ enum LW { One = 1, Two = 2, Three= 3, Four = 4, Five = 5, }; // DEFAULT INPUTS : START input int HGrid_Weeks = 25; // Weeks input double HGrid_Pips = 5000.0; // H-Grid Size input color HLine_2=MidnightBlue; // H-Grid 1 Round Number Color input LW Line_2_Width=1; // H-Grid 1 Width input ENUM_LINE_STYLE Line_2_Style=STYLE_DOT; // H-Grid 1 Style input color HLine_1=MidnightBlue; // H-Grid 2 Non Round Number Color input LW Line_1_Width=1; // H-Grid 2 Width input ENUM_LINE_STYLE Line_1_Style=STYLE_DOT; // H-Grid 2 Style input bool ShowOnVerticalPrice=true;//Show on vertical price input string H_Grid="hg"; // Label Text input bool Show_Label=true; // Label Visible input color Font_Color=DodgerBlue; // Label Color input int Font_Size = 11; // Font Size input bool Font_Bold = false; // Font Bold input int Font_Corner = 1; // Corner input int Left_Right = 25; // Left - Right input int Up_Down = 190; // Up - Down // DEFAULT INPUTS : END string HGrid_text; string FB; bool firstTime=true; datetime lastTime=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { firstTime=true; switch(Font_Bold) { case 0 : FB = "Arial"; break; case 1 : FB = "Arial Bold"; break; } return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { ObjectCreate("HGrid_txt",OBJ_LABEL,0,0,0); ObjectSet("HGrid_txt",OBJPROP_CORNER,Font_Corner); ObjectSet("HGrid_txt",OBJPROP_XDISTANCE,Left_Right); ObjectSet("HGrid_txt",OBJPROP_YDISTANCE,Up_Down); if(Show_Label==1) { ObjectSetText("HGrid_txt",H_Grid+": "+DoubleToString(HGrid_Pips,1),Font_Size,FB,Font_Color); } else { ObjectSetText("HGrid_txt",""); } int counted_bars=IndicatorCounted(); if(true /*lastTime == 0 || CurTime() - lastTime > 5*/) { firstTime= false; lastTime = CurTime(); if(HGrid_Weeks>0 && HGrid_Pips*10>0) { double weekH = iHigh( NULL, PERIOD_W1, 0 ); double weekL = iLow( NULL, PERIOD_W1, 0 ); for(int i=1; i<HGrid_Weeks; i++) { weekH = MathMax( weekH, iHigh( NULL, PERIOD_W1, i ) ); weekL = MathMin( weekL, iLow( NULL, PERIOD_W1, i ) ); } double pipRange=HGrid_Pips *10*Point; if(Symbol()=="GOLD" || Symbol()=="XAUUSD") { pipRange=pipRange*10.0; } double topPips = (weekH + pipRange) - MathMod( weekH, pipRange ); double botPips = weekL - MathMod( weekL, pipRange ); for(double p=botPips; p<=topPips; p+=pipRange) { string gridname="grid_"+DoubleToStr(p,Digits); ObjectCreate(gridname,OBJ_HLINE,0,0,p); double pp=p/Point; //int pInt = MathRound(pp); int pInt=StrToInteger(DoubleToStr(pp,0)); int mod=100; if(Symbol()=="GOLD" || Symbol()=="XAUUSD") mod=1000; if((pInt%mod)==0) { ObjectSet(gridname,OBJPROP_COLOR,HLine_2); ObjectSet(gridname,OBJPROP_STYLE,Line_2_Style); ObjectSet(gridname,OBJPROP_WIDTH,Line_2_Width); ObjectSet(gridname,OBJPROP_PRICE1,p); if(!ShowOnVerticalPrice){ ObjectSetInteger(ChartID(),gridname,OBJPROP_BACK,true); }else{ ObjectSetInteger(ChartID(),gridname,OBJPROP_PRICE_SCALE,false); } } else { ObjectSet(gridname,OBJPROP_COLOR,HLine_1); ObjectSet(gridname,OBJPROP_STYLE,Line_1_Style); ObjectSet(gridname,OBJPROP_WIDTH,Line_1_Width); ObjectSet(gridname,OBJPROP_PRICE1,p); if(!ShowOnVerticalPrice){ ObjectSetInteger(ChartID(),gridname,OBJPROP_BACK,true); }else{ ObjectSetInteger(ChartID(),gridname,OBJPROP_PRICE_SCALE,false); } } } } } return(rates_total); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { for(int i=ObjectsTotal()-1; i>=0; i--) { string name=ObjectName(i); if(StringFind(name,"grid_")>=0) ObjectDelete(name); } ObjectDelete("HGrid_txt"); return; } //+------------------------------------------------------------------+
He did help and it was logical — If you remove both the horizontal and vertical lines, then you might as well remove the indicator itself.
If that is not what you are asking, then please explain in more detail, or else we will end up misunderstanding your request.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi. Could someone help remove the display of Grid values shown in Blue in the picture below from the MT5 indicator attached, please? I only need to use the Grid lines but I don't want to see the grid values displayed on the Vertical Price of the chart.