MQL4 Learning - page 62

 
Drake:
Hi friends,

don't leave me alone.

Help me please.

What have you already done? Show us and I can help you to find mistakes.

 
Roger09:
What have you already done? Show us and I can help you to find mistakes.

Right.

My obj is to find the Max and the Min of a certain hourly candle , for example the one from the 8,00 to 9,00 ( gmt+1) .

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

int start()

{

int R = Time Hour(Time[0]); //---to determine the hour of a rising candle

int L = TimeHour(TimeLocal()); //---to determine my PC hour

int Delta = ( R- L );

double ValMax,ValMin;

for(i=0;i<24:i++)

{

if (TimeHour(iTime(NULL,PERIOD_H1,i))==8+Delta)

{

ValMax = iHigh(NULL,PERIOD_H1.i);

ValMin = iLow(NULL,PERIOD_H1,i);

break;

}

}

return;

}

//--------

 
 

sell EA

Hi,

I want to write an EA who just open order SELL. If you have something like this, please share with me. thank you!

 
Drake:
Right.

My obj is to find the Max and the Min of a certain hourly candle , for example the one from the 8,00 to 9,00 ( gmt+1) .

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

int start()

{

int R = Time Hour(Time[0]); //---to determine the hour of a rising candle

int L = TimeHour(TimeLocal()); //---to determine my PC hour

int Delta = ( R- L );

double ValMax,ValMin;

for(i=0;i<24:i++)

{

if (TimeHour(iTime(NULL,PERIOD_H1,i))==8+Delta)

{

ValMax = iHigh(NULL,PERIOD_H1.i);

ValMin = iLow(NULL,PERIOD_H1,i);

break;

}

}

return;

}

//--------

Try that:

extern int delta=-6;//number hours between your broker server and GMT

extern int needhour=8; //time when you need know max and min

int start(){

double ValMax,ValMin;

int myhour;

myhour=TimeHour(Time[0])+delta-needhour;

if(myhour<0)myhour+=24;

ValMax = iHigh(NULL,PERIOD_H1,myhour);

ValMin = iLow(NULL,PERIOD_H1,myhour)}

return(0);

}
 

Thanks a lot ,

I'll try it !

 

Appreciate an elaborate answer

Capablanca:
I'm not a trained programmer but have learned a few things from trial and error and have been able to create simple indicators for myself, but there are still lots of basic things that I'm unclear on. The for loop is one of them. Is there a material difference between code that goes "for(i=0;i0;i--)"? When does one use one and not the other?

Please elaborate on this providing examples.

Thanks

 

window size

how i can to get the x and y coordinates of a window in pixels to positionate a object in a determined location with ObjectSet(obj_name, OBJPROP_XDISTANCE, value_in_pixels)?

I want to draw one symbol at diferent locations in one window but the position relative to the window is important to me.

 

nobody can to help me?

sry for my english.

 

Can we create EA uses Euclidean_Metric?

Hello all

The result of Stat_Euclidean_Metric EA is very very great on the backtest but It can not do that on demo and real account.

I need to know , Is it Possible we create EA depend on the same idea and work on real account? Is it Possible it gives us result on real account as same as the result on backtest?

Thanks

Reason: