How to code? - page 134

 

Hello,

Thanks for the reply. So how is it really done ?

What I need to do is to check if the bar has ended on a different time frame.

For exemple, with the chart on 30 MIN I want to check if we have a new bar on the 240 MIN

Thanks!

 
callan300:
Hello,

Thanks for the reply. So how is it really done ?

What I need to do is to check if the bar has ended on a different time frame.

For exemple, with the chart on 30 MIN I want to check if we have a new bar on the 240 MIN

Thanks!

Do you plan to use for the checkin of the fractal system?...

 

Well I'm back for help again lol but there's no suprise there

could someone please post the code for opening a position 1min after a new bar is open.

I have been trying to do this but don't know where to start. I have been looking at it for the cat of nine tails experiment it migt be a waste of energy but we have to try these things. unless someone else have done this before if please let be know you results.

T1=1 min

T2=2min etc

if (minute() =T1>open && Price > open = Long);

I'm rubbish at this coding lark

 

Something like this ?

if(TimeCurrent() == Time[0] + T1 * 60)

{

}

 

thanks Michel

i will give it ago

 

Help, Very difficult question!!!!

How can I let one indicator to show another indicator's Multi Timeframe

situation and give us alert?

For example:

A indicator Only one timeframe situation shown)

functionA (it's a complex program)

B Indicator Show A indicator's different timeframe situation)

functionA M5 situation

functionA M15 situation

functionA M30 situation

functionA H1 situation

functionA H4 situation

functionA D1 situation

......

Best regards

Franky

 

You could try looking in the MetaEditor help file at the iCustom function. That should help you accomplish what you're after.

Good Luck

Lux

 
Michel:
Something like this ?

if(TimeCurrent() == Time[0] + T1 * 60)

{

}

You must give more room for the condition because ticks don't come each second. If there's no tick at bar opentime + Xseconds, the condition will be false.

FerruFx

 
FerruFx:
You must give more room for the condition because ticks don't come each second. If there's no tick at bar opentime + Xseconds, the condition will be false. FerruFx

You are absolutely right. But it was just to give some idea. I think the problem for Beno is to avoid the TradeContextBuzy, opening several positions at the open of a bar.

I don't think that to use a timer is a good idea. For this kind of problem, or Requote etc, usually I set a flag at the open of the bar, and this flag is reset when the order is opened. Until the position is opened, a try is done every tick. Something like this:

if(Time[0] > BarTime)

{

BarTime = Time[0];

if(....) OpenLong = true;

}

if(OpenLong) OpenLong = OrderSend(.....) < 0;

[/PHP]

I use the same kind of technique to close many positions and it works very well :

[PHP]

.....

if(CloseAllLongs) CloseAll(OP_BUY);

if(CloseAllShorts) CloseAll(OP_SELL);

}

void CloseAll(int Type)

{

int cnt = 0;

for(int i = OrdersTotal(); i >= 0; i --)

{

if(!OrderSelect(i, SELECT_BY_POS)) continue;

if(OrderSymbol() != Symbol()) continue;

if(OrderMagicNumber() != Magic) continue;

if(OrderType() != Type) continue;

cnt ++;

OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, White);

}

if(Type == OP_BUY) CloseAllLongs = (cnt > 0);

if(Type == OP_SELL) CloseAllShorts = (cnt > 0);

}
 
Beno:
thanks Michel i will give it ago

I have been trying to do this all day.

Is there anyone who can code MT4 that is based in the uk. I am on the road everyday so distance is no a problem unless u live in scotland it's a bloody long drive. if so pm me

I'm rubbish at this and would like some training/guidance 1 on 1.

I am making money in forex but that is manually not a lot but it's fairly constant and I'm letting compounding do the work.

With auto everything need to be just perfect and there is no room for discretion.

Cheers

Beno

Reason: