coding help needed

 

Hi all,

Great forum, I'm new to the mql4 programming, so it would be great if you could humour me a bit to start with.

I want to make sure that the last trade was closed at least 40 mins before opening the next trade (I'm using an ma crossover system and it's an attempt to cut out some of the wipsaws). I have coded the time check as below so far, but don't know if it's doable that way.

Any help would be greatly appreciated.

Cheers,

Tristan :)

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_HISTORY)==true)
{
if OrderCloseTime() - OrderOpenTime > 2400;
{

ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,NULL,0,0,Green);
}

}

 

Your code checks to see that the last trade was open longer than 40 minutes.

try:

if (Time[0] - OrderCloseTime()) > 2400;

 
tristan wrote >>

Hi all,

Great forum, I'm new to the mql4 programming, so it would be great if you could humour me a bit to start with.

I want to make sure that the last trade was closed at least 40 mins before opening the next trade (I'm using an ma crossover system and it's an attempt to cut out some of the wipsaws). I have coded the time check as below so far, but don't know if it's doable that way.

Any help would be greatly appreciated.

Cheers,

Tristan :)

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_HISTORY)==true)
{
if OrderCloseTime() - OrderOpenTime > 2400;
{

ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,NULL,0,0,Green);
}

}

phy

i see you helping out a lot around here, i will call you the forum sage.

thanks :)

Reason: