I have an earlier version of the Trading Sessions vLines indicator that doesn't allow for color or style changes of the lines that correspond to the Asian, UK, US sessions.
I went to forex factory and found a link to a v1 that allowed for these changes, but the link is broken.
Can someone be so kind to attach this if you have it? I'd be most grateful.
Use that MQL search box, search for it and click 'code base' on left panel of search result. Search for any part of it, Trading, or Session, ... you have the idea.
I already did that before I posted. Nothing came up in the search.
Unlike others, I try to find before I ask so I don't waste other's valuable time:)
The link seemed to work for me ...
Note that the code is written for 2005 and 2006 only. Other years will not work with daylight saving working correctly.
int items=ArrayRange(objNames,0)-1; Print(items, " objects to delete");
int i = 0;
//make sure to delete all objects created when unloading this indicator
//this routine cycles thru the stored list of unique vertical line names
//and deletes the objects with that name
for (i=items; i>=0;i--)
//all valid object names will have at least one character, so skip empty strings
if(objNames[i] != "")
This code looked quite reasonable until I got to the ObjectsDeleteAll() at the end. I'm not sure if this was a later modification by somebody else, but it is pretty bizarre.
Sometimes I see code and I wonder why the author(s) didn't actually finish writing it.
int pos = Bars-1;
int i = 0;
if(Bars - counted_bars == 1) return(0);
pos = (No_Bars_To_Calculate);
//initialize all elements of the array to empty string
for (i=ArrayRange(objNames,0); i>=0;i--)
objNames[i] = "";
Here we set a variable, pos, to a certain value. Then we ignore that value, having never used it, and load the variable with another value.
Returning when Bars - counted_bars == 1 is an interesting variant on the once_per_bar method, but I don't think it is better.
Thanks everyone. Although I'm not a programmer. So I guess I'll just have to mentally adjust for daylight savings?
When you say the author didn't finish writing it, will this still work? I have the previous (original) version. I wanted to modify the lines...color/style.
If this is problematic, I'll just stick with the original.
>When you say the author didn't finish writing it, will this still work?
That's just me being critical of redundant code which should have been cleaned up. it doesn't affect the functionality at all.
The functionality issues relate to the hard-coded dates of 2006 and 2007 which clearly will not work now. If you work out daylight saving time yourself then that may be ok.