Getting custom gridline indicator to attach - page 2 12 New comment Vladimir Karputov 2022.03.30 07:22 #11 Nagisa Unada # : I have tried debugging the loop from start to finish and nothing happens. I can't figure out what the bug is. Please show a video where you can use debugging. Shino Unada 2022.03.30 08:07 #12 Vladimir Karputov #: Please show a video where you can use debugging. I couldn't upload it here due to file size, so I sent it via messenger. Vladimir Karputov 2022.03.30 08:18 #13 Nagisa Unada # : I couldn't upload it here due to file size, so I sent it via messenger. Okay. Now study the MathMod documentation and correct your mistake - make sure that the cursor gets inside the loop: obj_name = "Grid_" + IntegerToString(i); if(ObjectFind(0, obj_name) < 0) { price = (double)i / (double)Divisor; ObjectCreate(0, obj_name, OBJ_HLINE, 0, time[1], price); ObjectSetInteger(0, obj_name, OBJPROP_STYLE, Line_Style); ObjectSetInteger(0, obj_name, OBJPROP_WIDTH, Line_Width); ObjectSetInteger(0, obj_name, OBJPROP_COLOR, Line_Color); ObjectSetInteger(0, obj_name, OBJPROP_BACK, true); ObjectSetString(0, obj_name, OBJPROP_TEXT, DoubleToString(price, Digits() - 2)); } Documentation on MQL5: Math Functions / MathMod www.mql5.com MathMod - Math Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5 Vladimir Karputov 2022.03.30 08:23 #14 Now the next problem: you need to prevent the constant re-creation of graphical objects. Vladimir Karputov 2022.03.30 08:27 #15 ChartRedraw (); do not need to use - when a new tick arrives, the terminal itself redraws the chart and all graphical objects. Vladimir Karputov 2022.03.30 08:29 #16 Recommendation: change the time time[1] on the time[rates_total-1] Shino Unada 2022.03.30 08:52 #17 Vladimir Karputov #: Now the next problem: you need to prevent the constant re-creation of graphical objects. If an already existing object is found by "ObjectFind", it will not be regenerated. Vladimir Karputov #: do not need to use - when a new tick arrives, the terminal itself redraws the chart and all graphical objects. Indeed it is. Vladimir Karputov #: Recommendation: change the time on the //ArraySetAsSeries(close, true); close[rates_total-2] Since it is the second bar from the last, it is -2. I changed the MT4 code and unintentionally did so, and you are correct. Help..drawing vertical lines in Past Candle Question Displaying variable with formatting Vladimir Karputov 2022.03.30 08:53 #18 Nagisa Unada # : If an already existing object is found by "ObjectFind", it will not be regenerated. Indeed it is. Since it is the second bar from the last, it is -2. I changed the MT4 code and unintentionally did so, and you are correct. Now the code is working. Are there any other problems? Shino Unada 2022.03.30 09:01 #19 Vladimir Karputov #: Now the code is working. Are there any other problems? Nothing in particular. Thank you. 12 New comment
I have tried debugging the loop from start to finish and nothing happens.
Please show a video where you can use debugging.
Please show a video where you can use debugging.
I couldn't upload it here due to file size, so I sent it via messenger.
I couldn't upload it here due to file size, so I sent it via messenger.
Okay. Now study the MathMod documentation and correct your mistake - make sure that the cursor gets inside the loop:
Now the next problem:
you need to prevent the constant re-creation of graphical objects.
ChartRedraw ();do not need to use - when a new tick arrives, the terminal itself redraws the chart and all graphical objects.
Recommendation: change the time
time[1]on the
time[rates_total-1]Now the next problem:
you need to prevent the constant re-creation of graphical objects.
If an already existing object is found by "ObjectFind", it will not be regenerated.
do not need to use - when a new tick arrives, the terminal itself redraws the chart and all graphical objects.
Indeed it is.
Recommendation: change the time
on the
Since it is the second bar from the last, it is -2.
I changed the MT4 code and unintentionally did so, and you are correct.
If an already existing object is found by "ObjectFind", it will not be regenerated.
Indeed it is.
Since it is the second bar from the last, it is -2.
I changed the MT4 code and unintentionally did so, and you are correct.
Now the code is working. Are there any other problems?
Now the code is working. Are there any other problems?
Nothing in particular. Thank you.