If you dont mind is it possible to get MT5 version of this indicator .
Trade The Probability
MT5 Time Frame Access Buttons 4 replies
MT4 GUI - Draw Buttons, Change Timeframes and Symbols 1 reply
Is it possible? Buttons for buy and sell and close open orders 3 replies
Help to make buttons in EA 0 replies
Disliked{quote} hi mate, hope this meets your expectations for other files I'm working on, please be patient {image} {file}Ignored
Dislikedkvak, can you help me with this? Would like to have a toggle button to the hh-lh-ll_hl indicator. Secondly, can you adjust the hh, lh texts as they appear far away from the candles unlike the hl.ll text appearing close to the candles. Could not adjust it from settings. It needs some fix. Will appreciate. Thanks in advance. {file} {image}Ignored
DislikedThis classic indicator could do with having an On/Off Button. Be aware that the indicator is placed in multiple instances. {file}Ignored
OnChartEvent(...) { //// Method 1: At the very least, skip the bulk of what are usually unwanted event id's. NOTE that these //// events might have been enabled not by this indicator but by some OTHER indicator on the same chart! //// This appears to make this indy compatible with other programs that enabled CHART_EVENT_OBJECT_CREATE and/or CHART_EVENT_OBJECT_DELETE : //if(id==CHARTEVENT_OBJECT_CREATE || id==CHARTEVENT_OBJECT_DELETE) return; //// If this, or another program, enabled mouse-events, these are usually not needed, so skip unless actually needed.: //if(id==CHARTEVENT_MOUSE_MOVE || id==CHARTEVENT_MOUSE_WHEEL) return; // Method 2 (Preferred): Check for a specific id and a specific sparam (object name) of interest, and ONLY act on that event! if (id==CHARTEVENT_OBJECT_CLICK && sparam == buttonId) { buttonStatus = ObjectGetInteger(0, buttonId, OBJPROP_STATE); ...
Disliked{quote} Here you go. I have coded the button using better (IMO) OnChartEvent() code which is *far* more efficient that many other Button implementations.Ignored
#define obj "indi_name" bool show_button; int OnInit() { if(ObjectFind(0,obj+"_OnOff")>=0){ if(ObjectGetInteger(0,obj+"_OnOff",OBJPROP_COLOR) == btn_text_ON_color) show_button = true;} //--- else{ ObjectCreate(0,obj+"_OnOff",OBJ_BUTTON,sub_window,0,0); //set button properties ... } ... } //--- void OnDeinit(const int reason) { if(reason==1 || reason==5 || reason==7 || reason==8){ ObjectsDeleteAll(0,obj,-1,-1); ChartRedraw();} //everything including on/off button is removed from chart //--- else if(reason==2 || reason==3 || reason==9){ ObjectsDeleteAll(0,obj+":",-1,-1); ChartRedraw();} //everything excluding on/off button is removed from chart } //--- void OnChartEvent(...) { if(CHARTEVENT_OBJECT_CLICK && sparam==obj+"_OnOff"){ if(ObjectGetInteger(0,obj+"_OnOff",OBJPROP_STATE)) ObjectSetInteger(0,obj+"_OnOff",OBJPROP_STATE,false); //--- show_button = !show_button; if(show_button) { ObjectSetInteger(0,obj+"_OnOff",OBJPROP_COLOR,btn_text_ON_color); ...} else { ObjectSetInteger(0,obj+"_OnOff",OBJPROP_COLOR,btn_text_OFF_color); ObjectsDeleteAll(0,obj+":",-1,-1); ...} ChartRedraw(); return;} }
Disliked{quote} I use another approach. 1. On/Off button state is always off, because it doesn't look good imo when its state is off (pressed). 2. On/Off button and other indicator's objects have different prefixes in their names. 3. On/Off button is removed from chart when it's necessary only, depending on user (coder) needs. Basically, it stays on chart, if symbol or chart period has been changed, saving its state, determined by its color. https://docs.mql4.com/constants/namedconstants/uninit #define obj "indi_name" bool show_button; int OnInit()...Ignored
//+------------------------------------------------------------------+ void OnDeinit(const int reason) //+------------------------------------------------------------------+ { // If just changing a TF', the button need not be deleted, therefore the 'OBJPROP_STATE' is also preserved. if ( reason != REASON_CHARTCHANGE && reason != REASON_CLOSE // && reason != REASON_RECOMPILE // Leave commented, if personal preference is to delete it when Re-Compiled. ) ObjectDelete(buttonId); del_obj(); return; }
Disliked{quote}I do agree that 'ChartRedraw()' could be a good idea to use as in your example.Ignored
Disliked{quote}On/Off button state is always off, because it doesn't look good imo when its state is off (pressed).Ignored