Hi Thanks for the indicator
Is it possible to add a option to disable the box which illustrate the open, high, close, low ,volume and other information please :)
Hi Thanks for the indicator
Is it possible to add a option to disable the box which illustrate the open, high, close, low ,volume and other information please :)
Hello Ohlcbars,
I've added this option but you have to wait 3 -5 days until it is approved.
Hello Ohlcbars,
I've added this option but you have to wait 3 -5 days until it is approved.
Great indi!
Anyone can guide me how to modify this indi so the intersection between HLine and VLine shows me my PC time instead broker time?
I appreciate if someone can guide me
Thanks in advance
Hi awran...
Thanks for indi
I add local time in the comment, and fix a bug when you click the chart (comment shows me 0)
//+------------------------------------------------------------------+ //| iCrosshair.mq4 | //| Copyright 2015, Awran5. | //| awran5@yahoo.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, Awran5." #property link "awran5@yahoo.com" #property version "1.01" #property strict #property indicator_chart_window //-- 1.01 Added: option to remove tooltip input bool ShowTooltip = true; // Show Tooltip input bool ShowComment = true; // Show Comment input color Color = clrTomato; // Line color input ENUM_LINE_STYLE Style = 2; // Line style input int Width = 1; // Line width input int BrokerZone = 3; // Broker Time Zone input int LocalZone = 7; // Local Time Zone double pips2double; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { if(Digits%2 == 1) pips2double = Point * 10; else pips2double = Point; Draw("H Line", OBJ_HLINE, Time[0], High[0], Color, Style, Width, "Click me!"); Draw("V Line", OBJ_VLINE, Time[0], High[0], Color, Style, Width, "Click me!"); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ObjectDelete("H Line"); ObjectDelete("V Line"); } //+------------------------------------------------------------------+ //| 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[]) { //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { if(!ShowComment) Comment(""); static bool keyPressed = false; if(id == CHARTEVENT_OBJECT_CLICK) { if(sparam == "H Line" || sparam == "V Line") { if(!keyPressed) keyPressed = true; else keyPressed = false; } if(keyPressed) ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, true); else ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, false); } //--- this is an event of a mouse move on the chart if(id == CHARTEVENT_MOUSE_MOVE) { //--- Prepare variables int x = (int)lparam; int y = (int)dparam; datetime time = 0; double price = 0; int window = 0; //--- Convert the X and Y coordinates in terms of date/time if(ChartXYToTimePrice(0, x, y, window, time, price)) { int bar = iBarShift(NULL, 0, time); string tooltip = ""; if(ShowTooltip) { tooltip="Candle: " + (string)bar + "\n" + "Open: " + DoubleToStr(Open[bar], Digits)+ "\n" + "High: " + DoubleToStr(High[bar], Digits)+ "\n" + "Close: " + DoubleToStr(Close[bar], Digits)+ "\n" + "Low: " + DoubleToStr(Low[bar], Digits)+ "\n" + "Volume: " + DoubleToStr(Volume[bar], 0)+ "\n" + "----" + "\n" + "Up wick: " + DoubleToStr(upWick(bar), 0)+ "\n" + "Body: " + DoubleToStr(BarBody(bar), 0)+ "\n" + "Down wick: " + DoubleToStr(dnWick(bar), 0); } //--- draw lines Draw("H Line", OBJ_HLINE, time, price, Color, Style, Width, tooltip); Draw("V Line", OBJ_VLINE, time, price, Color, Style, Width ,tooltip); if(ShowComment) { double Pips = fabs(price - Close[0]) / Point; Comment("Bar: " + (string)bar + "\n" + "Pips: " + DoubleToStr(Pips, 0) + "\n" + "Price: " + DoubleToStr(price, Digits) + "\n" + "Local Time: " + string((Time[bar] + ((LocalZone - BrokerZone) * 60 * 60)))); } } } if(id == CHARTEVENT_CLICK && ShowComment) { //--- Prepare variables int x = (int)lparam; int y = (int)dparam; datetime time = 0; double price = 0; int window = 0; //--- Convert the X and Y coordinates in terms of date/time if(ChartXYToTimePrice(0, x, y, window, time, price)) { int bar = iBarShift(NULL, 0, time); double Pips = fabs(price - Close[0]) / Point; Comment("Bar: " + (string)bar + "\n" + "Pips: " + DoubleToStr(Pips, 0) + "\n" + "Price: " + DoubleToStr(price, Digits) + "\n" + "Local Time: " + string((Time[bar] + ((LocalZone - BrokerZone) * 60 * 60)))); } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double upWick(int i) { double upBody = fmax(Open[i], Close[i]); return(fabs(High[i] - upBody) / pips2double); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double BarBody(int i) { double dnBody = fmin(Open[i], Close[i]), upBody = fmax(Open[i], Close[i]); return(fabs(upBody - dnBody) / pips2double); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double dnWick(int i) { double dnBody = fmin(Open[i], Close[i]); return(fabs(dnBody - Low[i]) / pips2double); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void Draw(string name, int type, datetime time, double price, color clr, int style, int width, string tooltip) { ObjectDelete(0, name); ObjectCreate(0, name, type, 0, time, price); ObjectSet(name, OBJPROP_COLOR, clr); ObjectSet(name, OBJPROP_STYLE, style); ObjectSet(name, OBJPROP_WIDTH, width); ObjectSet(name, OBJPROP_BACK, false); ObjectSet(name, OBJPROP_ZORDER, 0); ObjectSetString(0, name, OBJPROP_TOOLTIP, tooltip); ChartRedraw(0); } //+------------------------------------------------------------------+
Hi awran...
Thanks for indi
I add local time in the comment, and fix a bug when you click the chart (comment shows me 0)
Hi awran....
Asking permission for attach your iCrosshair to my custom indi. Ofcourse I add "Credit to: Awran5@yahoo.com" as a remark in my code.
Thanks

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
iCrosshair:
Handy crosshair for MetaTrader 4.
Author: awran5