You need to define the style of the line and to move it once a new month begins
like this:
Jan
if(ObjectFind("LastMonth-High") != 0) { ObjectCreate("LastMonth-High", OBJ_HLINE, 0, Time[0],lastMonthHigh ); ObjectSet("LastMonth-High", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("LastMonth-High", OBJPROP_COLOR, Red); // other line style changes } else { ObjectMove("LastMonth-High", 0, Time[0], lastMonthHigh); }Hope this helps,
Jan
janklimo:
You need to define the style of the line and to move it once a new month begins like this:
Jan
You need to define the style of the line and to move it once a new month begins like this:
if(ObjectFind("LastMonth-High") != 0) { ObjectCreate("LastMonth-High", OBJ_HLINE, 0, Time[0],lastMonthHigh ); ObjectSet("LastMonth-High", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("LastMonth-High", OBJPROP_COLOR, Red); // other line style changes } else { ObjectMove("LastMonth-High", 0, Time[0], lastMonthHigh); }Hope this helps,
Jan
Hi Jan,
Thanks for input. Colors for the lines are fixed. However the loops seems to be causing issue. Please see the attached file with your recommended changes. I am looking at ThisMonth-High & low and I don't see them at the right place. Not sure what causing it to mis-behave.
Any help is appreciated.
Thanks
The_One
Files:
Should work now. I changed the logic a bit since I have no idea why it didn't work
the way you wrote it and fixed the last year's calculation.
Files:
janklimo:
Should work now. I changed the logic a bit since I have no idea why it didn't work the way you wrote it and fixed the last year's calculation.
Should work now. I changed the logic a bit since I have no idea why it didn't work the way you wrote it and fixed the last year's calculation.
Hey Janklimo,
This is a great indicator you provided. Now how can I get the highest high and lowest low for first, second, third and fourth Quarter for last year? Also Semi-Annual? I'm not that great at coding and I was wondering if you could help me out.
Thanks so much!
Cheers!
Jan Klimo:
Should work now. I changed the logic a bit since I have no idea why it didn't work the way you wrote it and fixed the last year's calculation.
Should work now. I changed the logic a bit since I have no idea why it didn't work the way you wrote it and fixed the last year's calculation.
First,
Very great help from you. Thank you very much.
Now, to make it really perfect, i want to get the beginning of the last year. I will put a vertical line on it.
I understand how to get the last day, week, month's start date, but not for the last year.
Please help.
Regards.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am trying to write a indicator to draw high and low of Last/Current Month and Last/Current Year. With the help of the members here I was able to get the indicator working however there are couple of things I would like to get help with:
1. All the lines are drawn RED even though I mentioned different colors.
2. There is no loop in the indicator to change the lines with the change of coming months and so on.
Can someone please look at my code and suggest the changes?
Thanks in Advance
The_One