Ask! - page 112

 

int start(){

if (TimeCurrent()>D'2008.06.15 12:00:00'){Comment("sorry, expired!"); return(0);}

...

}

Yoda_Glenn:
How do I add an expiration date to my EA?
 

iBarShift will find for you the bar that start on that day or also the end bar for that day.

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)

next...

use those bar positions to find the results of iHighest and iLowest

int iHighest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)

int iLowest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)

results & done

TheRumpledOne:
I would like to know what bar the highest high and lowest low occurred for today on H1 or less time periods.

I know I can use a for loop and check.

Is there a more elegant way to do this?

Is there a first bar of today function?

Thanks.
 
IN10TION:
int start(){

if (TimeCurrent()>D'2008.06.15 12:00:00'){Comment("sorry, expired!"); return(0);}

...

}

I copied and pasted this code under the "Initialization" part of my EA's code, and then I got this error message:

'start' - function already defined and has a body

What could I be doing wrong? Thanks!

 

you are almost there yes you have a "init" part (initialization) and also a "start" part...

put it in the start part as I did it in the example...

why?

1. because init will run only ones, in the "start" part it will block continues.

2. your error message = you can't use a start() into a init() function

Have a nice weekend

Yoda_Glenn:
I copied and pasted this code under the "Initialization" part of my EA's code, and then I got this error message:

'start' - function already defined and has a body

What could I be doing wrong? Thanks!
 
Files:
rsi.gif  81 kb
 
IN10TION:
you are almost there

yes you have a "init" part (initialization) and also a "start" part...

put it in the start part as I did it in the example...

why?

1. because init will run only ones, in the "start" part it will block continues.

2. your error message = you can't use a start() into a init() function

Have a nice weekend

Thanks for your help! I compiled it with no errors, but I have to wait till the market opens up on Monday to test it. I have one question about expiration codes with EAs: What does the EA check the date against? Is it getting the date information from the Meta Quotes charts, the broker's server or from the actual computer that the EA is running on? If it is the latter (from the actual user's computer) then what keeps a user from simply changing the date on his computer to fool the EA's expiration? Just wondering...

 

TimeCurrent( )

Returns the last known server time (time of incoming of the latest quote) as number of seconds elapsed from 00:00 January 1, 1970.

Note: At the testing, the last known server time is modelled.

Yoda_Glenn:
Thanks for your help! I compiled it with no errors, but I have to wait till the market opens up on Monday to test it. I have one question about expiration codes with EAs: What does the EA check the date against? Is it getting the date information from the Meta Quotes charts, the broker's server or from the actual computer that the EA is running on? If it is the latter (from the actual user's computer) then what keeps a user from simply changing the date on his computer to fool the EA's expiration? Just wondering...
 

try this one...

cutzpr:
I am in need of some help. This is my first attempt in trying to code.

I am trying to modify the RSI Filter indicator made by igorad with no success. Pretty much all I want is to combine two different periods into one indicator.

I would like the new indicator to only paint when both values of both periods are exactly the same. My code is compiling correctly but is not painting.

Files:
 

Can anyone answer this question... I would really appreciate the help...

kiromano:
Guru,

I have been racking my brain to figure out how to get my indicator to use a simple dash instead of Wingdings. I am trying to avoid using ObjectCreate if possible. I know there must be a simple way, because it's listed in the online help at MT4 site. If I'm reading it correctly the number 4 should be a dash, however when I use the number 4 as and arrow, it gives me the default checkmark.

I'm not looking for a dashed line, just a single dash to mark a point on any given bar.

Great thread, by the way.
 

can you send your code, the way it is now... and if possible make a picture in what you want... it's a little unclear about the result...

Have a nice weekend!

kiromano:
Can anyone answer this question... I would really appreciate the help...
Reason: