Awesome!

Thanks guys.  I was hoping it would be that way, but did not expect it would be the answer.

The indicator I have written can be called like any other, so programmers no longer really need my IsNewsTime() function/library.

But I did not want to make it too cumbersome to call with a dozen parameters.... Now it's not an issue.

With that all in mind, and so you all can test with it, I release version 01 of FFCal (Forex Factory Calendar).

Keep a couple things in mind:

1) It hasn't been tested much.  There may be bugs.

2) You still have to give it the offset of your broker from GMT time.  First parameter, defaulted to 1 (GMT+1).

3) It doesn't draw anything on the screen at this time.  So what DOES it do?

    It gets each news time for the currency pair on the chart its applied to.  It puts the minutes until each event in the index zero buffer.  In the index one buffer, at ExtMapBuffer1[0], it puts the minutes until the most recent passed event (so this number will be negative).  In ExtMapBuffer1[1] it puts the number of minutes until the next event for your currency pair, and filtering accouring to the impact filters you have set.  Therefore, a programmer can call this as such:

    MinutesUntilLastNewsEvent = iCustom(NULL, 0, "FFCal", 1, 0);     // will be zero or negative
    MinutesUntilNextNewsEvent = iCustom(NULL, 0, "FFCal", 1, 1);    // will be positive as long as there is a next event.

Also, it puts out a comment at the top left of the chart announcing the time until the next news event, as well as some additional info.  Please note that for now, once an event has passed, the minutes until event will be negative.  I was not sure how long I should post the info from the expired event, but decided for now to do so until the next event is closer than the previous one.

The indicator also does 2 optional alerts.  These values are defaulted to -1.  Change them to minutes if you want the alerts, e.g.:

setting....

Alert1MinsBefore    = 15;
Alert2MinsBefore    = 25;

...willl cause the EA to put up an alert 15 and 25 minutes before each event.

Please use, test, let me know what's wrong, or what else you would like it to do.  If you want to change the code, PLEASE comment your changes well, increment the version number, ans send it back to me.

Best to all!  Sorry it took so very long.  Thanks to Ron for his support.  Hope I haven't forgotten anything; it's late and I need to get some sleep.

-Derk







On 2/11/07, Ronald Verwer <rverwer@bigpond.com> wrote:
Hi Derk,
 
Great to hear that you mastered the "News Avoidance Beast". Congratulations!
 
Yes, you can use the default settings of an indicator when called through the iCustom function by just eliminating all parameters otherwise required to set the external data of the indicator. By leaving them out, the system will take the default values.
 
e.g. after the name you only put in the mode and the shift. The line would become x=iCustom(NULL,0,"NewsAvoidance",0,i) where the last zero is the buffer number of the data buffer, and i is the index of the value taken from that particular indicator buffer.
 
Hope this helps.
 
Cheers, and happy trading.
 
Ronald (aka rover).
Forex MetaSoft.
 
 
...   -   Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of extern variables of the custom indicator.
mode   -   Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.
shift   -   Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
----- Original Message -----
From: Derk Wehler
Sent: Monday, 12 February 2007 16:27
Subject: [MT_E and I] News Avoidance

Greets all:

It looks like I have the basic news avoidance indicator about done.

One question for any programmer who can answer though... when you make an iCustom call (which is what you can now do to use the new indicator), it seems you have to send in all the parameters... Is it not possible to just have it use the default ones?

-Derk