I have been writing my own custom SR indicator and have one glaring problem I haven't been able to fix. At the rollover of a new day (and subsequent recalculation of Daily SR levels by the indicator) my SR lines all start drawing at 45 degree angles across the chart and the labels don't update their text. Here is an excerpt from my indicator that draws a SR line and prints the label below it.
value =DoubleToStr( R1,4);if(ObjectFind("R1_Line")<0){ObjectCreate("R1_Line",OBJ_TREND,0,Time[0], R1,Time[1], R1);ObjectSet("R1_Line", OBJPROP_COLOR,Orange);ObjectSet("R1_Line", OBJPROP_STYLE,STYLE_DOT);}else{ObjectMove("R1_Line",0,Time[0], R1);}if(ObjectFind("R1_Label")<0){ObjectCreate("R1_Label",OBJ_TEXT,0,Time[20], R1);ObjectSetText("R1_Label","DR1"+" ("+ value +")",8,"Verdana Bold",Black);}else{ObjectMove("R1_Label",0,Time[20], R1);}
The problem can be temporarily fixed by opening the indicator window (CTRL+I) opening the indicator settings, pressing RESET and then OK - OR by re-compiling the indicator in MetaEditor. So if there was some way to make the indicator realize the day has changed and then reset itself automatically then that may fix the issue permanently.
Any help would be much appreciated although testing a fix only happens once a day =(
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have been writing my own custom SR indicator and have one glaring problem I haven't been able to fix. At the rollover of a new day (and subsequent recalculation of Daily SR levels by the indicator) my SR lines all start drawing at 45 degree angles across the chart and the labels don't update their text. Here is an excerpt from my indicator that draws a SR line and prints the label below it.
The problem can be temporarily fixed by opening the indicator window (CTRL+I) opening the indicator settings, pressing RESET and then OK - OR by re-compiling the indicator in MetaEditor. So if there was some way to make the indicator realize the day has changed and then reset itself automatically then that may fix the issue permanently.
Any help would be much appreciated although testing a fix only happens once a day =(