How to code? - page 10

 

Code Needed to set Time to Trade in EA

Hi, Can anyone help me with the code for the following:

I have an EA which I want to trade 3 times or less in a day dependin g on the time. The times are as follows (GMT+1), 08:00 - 12:00, 16:00 - 20:00 and 20:00 - 00:00 (the 20:00 to 00:00 should be optional). Could maybe set with TRUE/False values??

Any help much appreciated

 

extern bool OOAAT = false;

extern datetime allowtime = D'2006.05.17 00:00';

//--------------

int strat()

{

...............any code.................

bool allowtrade=true;

if(OOAAT)

{

if(CurTime()>allowtime) allowtrade=true; else allowtrade=false;

}

if(allowtrade)

{

........trading code........
}

...............any code..................

}

-------------------------------------------------------------------

note :

-OOAAT =open only after a time

-to be more specific you can put other condition(s) in the big-italic-underline line

hope this help

 

Hi, Thank you so much. Will try it out

 

EA utility- request for code/programmers

Ok I see only one more obstacle to get over for me to really get working on strategy development. I don't know how to code...

however...

I am aware of this utility

http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

BUT I have not yet figured out how to get the custom indicators which are being developed here on to it. It has 'some' indicators but there are custom indicators in use here and in development.

Can either someone show me how to use this utility WITH some of the custom indicators here (say aNina for example) or...

could some coding/programming people here develop a similar utility and have it on the site?

If this last hurdle can be overcome I'm going to really enjoy working with strategy development around here....

fingers crossed, is this doable?

 

Aaragorn,

Everybody saw this utility http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ and asked the questions about iCustom, Codersguru created the lessons and people asked the questions once again.

It was many months ago.

So you just wake up.

About iCustom see this thread.

https://www.mql5.com/en/forum/173108

And probably there is a lesson about iCustom.

And about all other questions concerning mql4 look at the Codersguru Lessons' section. Because in most cases the people asked the same questions already and it was answered and discussed enough many months ago.

What I did concerning iCustom?

I was reading that thread, tried to find the other information, then used this utility without iCustom, then corrected my EA manually inserting any indicators I wanted using iCustom.

 

unless I'm still asleep I'm not seeing the answer to my questions on the thread you posted. The thread you posted is about getting a code to work to return a specific value for what that person was doing.

My question is not about making a specific code work, It's about how to use the utility to include various custom indicators which may not already be available on the utility presently, how is it done?

It's entirely possible that I have a skitoma and what i'm looking for is right in front of me and I can't see it, so if YOU or anyone else sees what I'm missing I'd appreciate a link to it. I'm taking in as much of the information here on this site as fast and well as I can with my limitations of locating what is where. It's true I've not been around long enough to know my way around yet.

Thanks for alll your assistance.

 

But if you open this utility you will find "Custom indicator".

And you may use any indicator which is not mentioned. Anyone.

It is example from Codersguru post:

double diIXO21=iCustom(NULL,0,"LSMA in Color",14,1500,0,0));[/CODE]

parmeter 1 :the symbol - NULL for current symbol.

parmeter 2 : time frame - 0 for current time frame.

parmeter 3 : indicator name - here it's "LSMA in Color".

parmeter 4 : this is a setting for LSMA - Rperiod = 14.

parmeter 5 : this is a setting for LSMA - Draw4HowLongg = 1500.

parmeter 6 : the line number (range from 0 to 7) - usually used 0.

parmeter 7 : the working bar - 0 for the current bar.

And this 'diIXO21' is equal, above or below something (close price or some value). In case of ASCTrendsig indcator it is above zero for example.

The other example is I_XO_A_H indicator. This indicator is having 2 "lines" - red one and green one.

It is one line (uptrend):

double diIXO10=iCustom(NULL,0,"I_XO_A_H",BoxSize,0,1);

It is the other one (downtrend):

[CODE]double diIXO21=iCustom(NULL,0,"I_XO_A_H",BoxSize,1,1);

Last "1" in the code above is the close bar.

So if the first line is above zero (Number/Variable in this tool) it means uptrend on the closed bar.

We have it on the tool.

http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

And it was described in Codersguru posts.

But I am not using this utility for iCustom.

I included this iCustom manually.

This post helped me https://www.mql5.com/en/forum/173108

And I always looked inside the indicators' codes (and inside EAs' codes) just to have some examples.

And in Codersguru training section there are some templates to create EAs (with iCustom as well).

It is easy for me to have some "template" created by utility to include any iCustom indicators later.

 

how about this...walk thru using this utility with me to create an EA for the CatFX50 strategy for openings and a stepping trailing stop for exits.

here are the indicators for entries:

https://c.mql5.com/forextsd/forum/8/hist_stepma_stoch_kv1_ex_03.mq4

https://c.mql5.com/forextsd/forum/8/anina.mq4

https://c.mql5.com/forextsd/forum/8/catfx50_v2mookfx.mq4

strategy rules

https://c.mql5.com/forextsd/forum/8/catfx50_trading_guide_lines_290506.doc

I havn't found a stepping trailing stop indicator yet that lets me scale out but that's what I have in mind trying when I can find one.

For now it would be ok if the EA just did the entry automatically and I handled my exits manually I guess.

see what I'm trying to do now?

 

i tried to load the aNina Indicator using the browse/load feature on the site but nothing happens.

 
Aaragorn:
i tried to load the aNina Indicator using the browse/load feature on the site but nothing happens.

I just opened this aNina indicator and it is written the following inside the code:

if(iCustom(NULL,0,"0_IndInverse",2,cbars,1,i)!=0) return (i);

It means this indicator is using 0_IndInverse indicator and will not work without this indicator.

a_Nina indicator is using aNina indicator (two different indicators).

So you do not need to attach aNina indicator.

You should attach a_Nina.

Files:
a_nina.gif  20 kb