MQL4 Learning - page 127

 

I wrote a indicator , I can call my signal from indicator ;

thank you mladen for your time ,

Files:
eurusdh4.png  61 kb
 

Need Help, This is true or not ?, maybe iam wrong

Every n bar code is :

int current=0;

datetime BarTime=0;

if (BarTime < Time[0])

BarTime=Time[0];

 
akhmadfx:
Need Help, This is true or not ?, maybe iam wrong

Every n bar code is :

int current=0;

datetime BarTime=0;

if (BarTime < Time[0])

BarTime=Time[0];

If you want to save the bar time between two ticks then use something like this instead :

static datetime BarTime=0;

if (BarTime < Time[0]) BarTime=Time[0];

But from you r post not sure what are you trying to achieve

 
mladen:
If you want to save the bar time between two ticks then use something like this instead :

static datetime BarTime=0;

if (BarTime < Time[0]) BarTime=Time[0];

But from you r post not sure what are you trying to achieve

Thanks for fast reply Mladen,

I mean like this, I will get sound alert every 5 candle formed on D1 time frame, how i can code that,

thanks before

 
akhmadfx:
Thanks for fast reply Mladen,

I mean like this, I will get sound alert every 5 candle formed on D1 time frame, how i can code that,

thanks before

Since trading week has more or less 5 day (exceptions that open on Sunday and have that 1 or 2 hour Sunday data can be ignored), why don't you simply do something like this :

//

//

// the following cod would work on each Friday

// change the day to desired one

//

//

if (TimeDayOfWeek(time[0]) == 5)

{

// your code here

}

 
mladen:
Since trading week has more or less 5 day (exceptions that open on Sunday and have that 1 or 2 hour Sunday data can be ignored), why don't you simply do something like this :
//

//

// the following cod would work on each Friday

// change the day to desired one

//

//

if (TimeDayOfWeek(time[0]) == 5)

{

// your code here

}

Hehe... i forgot about TimeDayOfWeek, thanks Mladen for your help

 
mladen:
Since trading week has more or less 5 day (exceptions that open on Sunday and have that 1 or 2 hour Sunday data can be ignored), why don't you simply do something like this :
//

//

// the following cod would work on each Friday

// change the day to desired one

//

//

if (TimeDayOfWeek(time[0]) == 5)

{

// your code here

}

If i code like this :

if (TimeDayOfMonth(time[0]) == 5)

The following code will work on each Fifth candle at D1 time frame, is that true Mladen ??

becouse i need my code work once every month on specific candle (Fifth candle every month on D1 time frame)

 
akhmadfx:
If i code like this :

if (TimeDayOfMonth(time[0]) == 5)

The following code will work on each Fifth candle at D1 time frame, is that true Mladen ??

becouse i need to work my code once every month on specific candle

No.

It will work on every Friday (to make it work on every fifth candle it would need a starting date from which the candles would be counted)

 
mladen:
No. It will work on every Friday (to make it work on every fifth candle it would need a starting date from which the candles would be counted)

How about this one, i just thinking :

if ( Day() == 8 && Month() == 4 && Year() == 2013 )

This work on Fifth candle ( Like this day candle ),

and if i want to work on fifth candle next month, i just change the date, is that true Mladen ??

 
akhmadfx:
How about this one, i just thinking :

if ( Day() == 8 && Month() == 4 && Year() == 2013 )

This work on Fifth candle ( Like this day candle ),

and if i want to work on fifth candle next month, i just change the date, is that true Mladen ??

That code will be executed on April 8th of 2013. If you want it to be executed on fixed dates, you can used that format

Reason: