Topic: entry time help/suggestions 2

Hi again i'm newly in trouble with entry time rules. I created an EA which operates in such hours range:

from 6:00 to 13:00 (group A)
from 17:00 to 19:00 (group B)
from 22: to 23:00 (group C)

What i need is the above scenario from Monday to Thursday, and for Friday a new scenario:

from 6:00 to 13:00 (group D...?)
from 17:00 to 19:00 (group D...?)

Then i though to add day filter rules, one for each group A,B,C (monday -> thursday, each) and create a day filter only for friday, with group D. Maybe there will be a simpler method, indeed the program cannot let me insert so many rules..

Have you any idea?

Re: entry time help/suggestions 2

I made a simple Custom Indicator for your case - Time Grid.

The day / Time periods are pre-programmed, but it is very easy to be changed.

http://s13.postimg.org/mmhx0zmrr/screenshot_1261.png

The core of the indicator code:

// Calculation of the logic
for (int bar = firstBar; bar < Bars; bar++)
{
    int hour = Time[bar].Hour;
    switch(Time[bar].DayOfWeek)
    {
        case DayOfWeek.Monday    :
        case DayOfWeek.Tuesday   :
        case DayOfWeek.Wednesday :
        case DayOfWeek.Thursday  :
            signals[bar] = ((hour >= 6  && hour < 13) ||
                            (hour >= 17 && hour < 19) ||
                            (hour >= 22 && hour < 23)) ? 1 : 0;
            break;
        case DayOfWeek.Friday :
            signals[bar] = ((hour >= 6  && hour < 13) ||
                            (hour >= 17 && hour < 19)) ? 1 : 0;
            break;
        case DayOfWeek.Saturday :
        case DayOfWeek.Sunday   :
            signals[bar] = 0;
            break;
    }
}
Post's attachments

TimeGrid.cs 4.26 kb, 6 downloads since 2015-11-11 

TimeGrid.mqh 4.01 kb, 6 downloads since 2015-11-11 

You don't have the permssions to download the attachments of this post.

Re: entry time help/suggestions 2

Can this indicator be placed in the Repository?

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

4 (edited by alessandromagno 2015-11-09 11:53:04)

Re: entry time help/suggestions 2

Thank you Popov!

Re: entry time help/suggestions 2

Can you suggest me how to modify the indicator, if i need (.cs file)?

Re: entry time help/suggestions 2

Open it in any text editor. Preferably Notepad++

These cases are labels that separate the days of week. If you have several labels, all execute the same code.

case DayOfWeek.Monday    :

You can put conditions between the label if you want. Every condition finishes with "break;". If you miss the "break;" the program will continue with the next label.


For example the following code allows entries from 8:00 to 20:00 from Monday to Thursday and from 8:00 to 12:00 for Friday.

    switch(Time[bar].DayOfWeek)
    {
        case DayOfWeek.Monday    :
        case DayOfWeek.Tuesday   :
        case DayOfWeek.Wednesday :
        case DayOfWeek.Thursday  :
            values[bar] = (hour >= 8  && hour < 20) ? 1 : 0;
            break;
        case DayOfWeek.Friday :
            values[bar] = (hour >= 8  && hour < 12) ? 1 : 0;
            break;
        case DayOfWeek.Saturday :
        case DayOfWeek.Sunday   :
            values[bar] = 0;
            break;
    }

Re: entry time help/suggestions 2

I perfectly understand the method!! I'm using notepad++. But after saving my indicator under indicator folder, when i try to open again fsb appears such message:

http://s22.postimg.org/gdjbvynvx/Untitled.jpg

I'm sure i did something wrong with note++, since it's the first time for me...

Re: entry time help/suggestions 2

This message shows you that the indicator is already loaded from the original file TimeGrid.cs

If you want to use your version together with the original, you have to rename the class and the constructor, and the indicator name text.

http://s13.postimg.org/ihblstedf/screenshot_1264.jpg

    public class TimeGridProva : Indicator
    {
        public TimeGridProva()
        {
            IndicatorName     = "Time Grid Prova";
            PossibleSlots     = SlotTypes.OpenFilter;

Re: entry time help/suggestions 2

Popov wrote:

This message shows you that the indicator is already loaded from the original file TimeGrid.cs

If you want to use your version together with the original, you have to rename the class and the constructor, and the indicator name text.

http://s13.postimg.org/ihblstedf/screenshot_1264.jpg

    public class TimeGridProva : Indicator
    {
        public TimeGridProva()
        {
            IndicatorName     = "Time Grid Prova";
            PossibleSlots     = SlotTypes.OpenFilter;

The "error" popup still remains.... but now it works perfectly!
Thanks again

Re: entry time help/suggestions 2

The "error" popup still remains....

Clean the Library folder. The old dll causes the conflict.

Re: entry time help/suggestions 2

Yes i did and now works properly. But there is a new problem.....applying your indicator to a strategy i cannot export or save the EA: "expert advisor is not exported. Cannot create the expert file."

What's the problem?

Re: entry time help/suggestions 2

The problem is that there is no MQL version of the indicator. I'll make it this evening or tomorrow.

Re: entry time help/suggestions 2

Thank you for the efforts

Re: entry time help/suggestions 2

I added MQL version of the indicator to my first answer.
I made also minor changes in the CS code in order to make it looking as the MQL code.

Re: entry time help/suggestions 2

Hi Popov, which file i have to use/modify?

Re: entry time help/suggestions 2

You have to use both file.
Put the .cs file in "C:\Program Files\Forex Strategy Builder Pro\User Files\Indicators"
And the .mqh file in "C:\Program Files\Forex Strategy Builder Pro\User Files\MT4 Files\MQL\Forexsb.com\Custom"

The first one is used in FSB and the second one in the exported Expert Advisors.
If you want modifications, you have to modify both files in order to achieve the same results in MetaTrader.

17 (edited by alessandromagno 2015-11-11 18:51:30)

Re: entry time help/suggestions 2

Fast and clear!

Thanks Popov, but i got the same problem. It doesn't export the EA.

I also tried to copy the mqh in every folder of indicator, but nothing

Re: entry time help/suggestions 2

alessandromagno wrote:

Fast and clear!

Thanks Popov, but i got the same problem. It doesn't export the EA.

I also tried to copy the mqh in every folder of indicator, but nothing

I think you might be using your own modified indi with a different name (Time Grid Prova vs Time Grid), but it doesn't work because the naming is different between .cs and .mqh. Please add the error message itself also, then we don't have to guess what error is about.

19 (edited by alessandromagno 2015-11-12 12:28:09)

Re: entry time help/suggestions 2

Hi footon, unfortunately the names of .cs and .mqh are the same, these are not different...

Regarding the error, the simply message in the Output Log window is: ""expert advisor is not exported. Cannot create the expert file."

Re: entry time help/suggestions 2

Okay i uninstalled and reinstalled the software now works properly again...

Thank you guys