Forum Replies Created
- AuthorPosts
you’re most welcome GG53
I’ve attached the latest version of the newsCalendar indicator . I repaired a bug concerning backtesting and catching up data and the time it thinks it is when download latest calendar (I feel like such a dill) .
That would also lead to a well-structured design based on exchangeable modules instead of a monolithic design that’s getting harder to manage with each additional feature. To make single modules exchangeable, it’s also required to refrain from any use of global (input) variables inside those functions. Every function should internally use only local variables / parameters or parameters which are passed by reference when calling it. At the moment, we’re not very close to this preferred goal.
A well functioning system that has all the features listed has the potential to get quite complex on the software side.
IMHO structures and classes, implemented without using too much voodoo tricks, whilst (perhaps) beyond the amateur to implement, can more easily be modified / adapted by both the amateur and experienced programmer.
Great work:
Here is the latest NewsCalendar stuff.
I tested it, and after activating DLL import
it displayed a line, except for timeframe M1. When placed on an M1 chart, every second indicator buffer ImpactBufferis empty, so no line is displayed. I failed to find the reason in 5 minutes, so I’ll just report. One basic question: why do you exclude bar zero in your main loop inOnInit()? for(int i=limit-1; i>0; i–) s. EDIT: the M1 issue is related to the calendar file reading frequency. If this is reduced to zero, it works.Didn’t think of M1. I often leave bar 0 off my personal stuff so i guess I did that automatically – oops. (my tests of indicators are usually of bar 1)
this should fix it up
for(int i=limit-1; i>=0; i–)
{
datetime _time = Time;
if ((int(_time)-int(lastRefresh)) > minutesRefresh*60 ||
Period() == PERIOD_M1) // not more frequent than once/(minutesRefresh * minute)
{
lastRefresh = _time;
int impact = updateNewsCalendar(_time);
ImpactBuffer = impact;
if (impact == newsCalFile_NotFound) ImpactBuffer = -1;
if (impact == newsItem_noneSelected) ImpactBuffer = 0;}
}Great!
Here is the latest NewsCalendar stuff. Talking about Globals. I wacked the whole thing into a class to encapsulate it, as I didn’t want the array exposed.
As I posted somewhere else in this forum, I made the first steps of my ‘coding career’ using IBM punchcards and a language named FORTRAN 77 (now it’s up to you to make a guess about my physical age
) Anyway, OOP was not yet invented in those times. Until now, I failed to get a good grip on the OOP approach. An experienced OOP tutor is what I need. I will study your class code from a student’s point of view, and I hope you don’t mind if I post some noob questions as an OOP newbie. I’m not convinced that it makes sense to encapsulate each and every bit of code in a class or something, but I’m really interested to learn about the details that make the difference. When it comes to creating reusable code, OOP is certainly state of the art. s.Yeah, my career started with Z80 processors and assembler. I enjoyed Fortran 77 in Uni but not the pencil Cards

Definitely not a OOP pro. It maybe that I’m getting fuzzy memory and fuzzy brained these days, I do feel tested, and grizzle by the endless use of classes.
Structures are great – big fan. I probably would not have encapsulated the newsCalendar into a class if it was just for myself – out of laziness

for those learning programing:
Normally, classes are used more if the code needs to be reusable, (recently I wrote myself a rainbow indicator with 20 polynomial regression lines – class is the obvious choice for the design), where in the newsCalendar class this is not case. (It could be if you wanted an instance of newCalendar for each symbol) But in this case it was more for encapsulation benefits such as tidiness , safety for the myriad of variables and arrays it uses.
I haven’t done to much with MQL4 for a couple of years,so pre- ver600, now that classes are provided for I will be using them more and more.
Here is the latest NewsCalendar stuff.
Talking about Globals. I wacked the whole thing into a class to encapsulate it, as I didn’t want the array exposed. I was thinking about it last week and talked myself into it over the weekend.
The only global I now have is the NewsCalendar object that will sit in the indicator or EA.
Did some more optimisation re: unnecessary file and web access and also added a random factor to the frequency of web access so we don’t have everyone trying to download at the same time.
I’ll leave it there for the moment I think, see what everyone thinks.
Attachments:
You must be logged in to view attached files.Thanks Simplex.
I’m giving the sxClearChannel a workout today. So far I like it

I continued tweaking the Clear Indicator. Embedding it in an asymmetric ATR based channel seems to provide some nice entry triggers. What do you think? s.
I’m mesmerised by this chart. I keep looking at it. Can’t wait to see more of it

What the DisplayNewsCalendarImpactLine indicator looks like (loading history bars)
the image shows with the trace at -1 (no history) then the different impact levels
-
This reply was modified 10 years, 8 months ago by
fuzzy.
-
This reply was modified 10 years, 8 months ago by
fuzzy.
Attachments:
You must be logged in to view attached files.Hi all
This is a new version of the New Calendar function +.
- File sharing / locking done.
- Web access locking done.
- Locks clearing protocol .
- Calendar history loading implemented. (see displayNewsImpactLine indicator)
on indicator chart,
-1 – no history
0 – no news
1 – low impact
2 – med impact
3 – high impact
- Calendar history loading implemented. (see displayNewsImpactLine indicator)
Calendar files will get saved in the Files folder as expected.
I have included this weeks calendar file as a start to the history bank should you desire.
Simplex: I had no idea that the comments on the sinput line get displayed that way. Thanks for that.

I could improve the way loading history works, currently it reads the file each access. I’ll think about that tomorrow.
Attachments:
You must be logged in to view attached files.I wish I re-read this forum thread. I’ve only now seen your comments on file sharing and web access aspect of the newscal.. I’ll look at this aspect over the weekend. Should be simple enough, using the MQL’s GlobalVariables with some sort of random time init to grab control of the web downloading. etc.
Attached is the News calendar function and sample indicators.
derived from ffcal ; though I’ve rewritten most of it.
No timers are used in this function or indicators anymore.
Future version of it should be able to read in past calendar files.
the 2 sample indicators:
DisplayNews: as per Emonts, just shows a coloured panel green for all clear, yellow,orange then red for higher impact news.
DisplayNewsImpactLine: Shows a indicator trace on subwindow, indicating impact level, also comment on the top left of current news Item details. The trace doesn’t load any past data so, set the chart for 1 minute to see the trace add data in real time. The EA could read from the [0] element of this indicator or call the function itself.
Attachments:
You must be logged in to view attached files.or moving stops
Yes , that’s what I’ve been thinking . The function is simply called on a as need basis – . The indicator is purely to show the function working. The indicator has a timer event implemented by I’ll remove it and run it through the OnCalculate and run a one minute timer of sorts in there. The lowest possible resolution of the calendar is one minute so there is no need to poll it any faster than that, – or just before entering a trade.
A multi-instance timer lib sounds interesting. I think it could be useful.
I usually implement a timer of sorts in my EAs -( most of them pre – ver600 ) in an effort to lighten the load on the PC / VPS.
Hi Simplex and all

Well I’ve been busier than I’ve been in weeks. I’ve been delayed by other peoples problems

I hope to be ready for inspection sometime over the weekend, I’ve entirely rewritten the file parsing and calling function, – now going to look at tidying up the xml file download. (slowly removing all the globals etc
)I don’t think there is a lot of need for the indicator to use a timer, I am unsure how the EventSetTimer in an indicator affects the calling EA. This indicator need only be called once a minute or so I’m inclined to use the OnCalculate event and do my own one minute timer.
Hi All
I’ve been working on the news indicator / function today and I reckon I should take an extra day or so to tidy up.
A big thanks to Emonts putting it together. I take days and days to research and to plan it out to this point.
There’s been a lot of work done by different people on this FFcal and Simplex is right that there is an overuse of global variables.
I’ve changed the name of the main calling function as follows (if no-one objects) as I think I’d like to add some more features to FFcal.
its use in the indicator is as follows
int newsValue = getNewsImpactLevel(Symbol(), minutesBeforeNews, minutesAfterNews);
Righteo
I’ll put my hand up for the news filter – (if no-one more capable will beat me to it). If I don’t have any problems I’ll have it ready in the morning.
Hi all
I’ve been following this project and thought I should pipe up and make my presence known. Whilst I’m competent enough throw some code together, some of you guys appear to be far more professional than I. I’m not sure where I can be of assistance but I’m willing. For the moment I’m about to make a start on reading through the code and to become familiar with it. I’m quite slow and fuzzy these days so you’ll probably keep speeding past me.
BTW that Clear swing indicator is a little ripper

Cheers
Brother – you’re opening my eyes

I’ve never considered the income potential of swap rates.
from pepperstone; AUDJPY 3.12 ; NZDJPY 3.36 ; AUDUSD 2.04
So one could incorporate a carry trade component into this trading framework.
Hi MTH
Thanks for your generosity and your explanation to my question. I realize now you already said that you’re basically long only. Seems to me I have to read these things 3 times to pick on on everything.
In my case, the likes of IC Markets wouldn’t give me a no Swap account. Do you think the swap rate would overly harm you trading style ?
Hi MTM
I used to trade (write) index options (almost 20 years ago) and I would think the same way, place the trade – defend it until expiry.
Am I correct in saying that – on a particular currency, if you go long and it starts going negative you look for short opportunities ?
-
This reply was modified 10 years, 8 months ago by
- AuthorPosts