Low and High - page 3

 

I figure out where was problem (with your help). ;)

Thanks to all of you!

Now--->TESTING! (back testing looks very well)

 

I think the problem is that it opens orders at the levels you attached the EA to the chart, because Hour() returns the time in Hours you attached it. But you want to use this, I think:

TimeHour(Timecurrent())

Have a look in the documentation to see what I mean...

EP

 

If we can fix this, then I have my holy grail! :D
 
ErrorProgrammer:

I think the problem is that it opens orders at the levels you attached the EA to the chart, because Hour() returns the time in Hours you attached it.

It doesn't actually help solve 01005379's problem, but I don't think this is right. For example, running the following EA in the strategy tester shows a varying value for Hour() corresponding to the simulated broker time.


int start() {Comment("Hour: " + Hour() + "   @ " + TimeToStr(TimeCurrent(), TIME_DATE | TIME_MINUTES));}

I think what the documentation is trying to say is that Hour(), Minute() etc don't change during a call to start(). But they do change over the EA's lifetime.


 
01005379:

If we can fix this, then I have my holy grail! :D

That bar looks quite oversized. does the same thing happen with other orders? It maybe because of the volatility in that particular bar.

 
fxcourt:

That bar looks quite oversized. does the same thing happen with other orders? It maybe because of the volatility in that particular bar.

Now, it's same with other orders. Order is open one bar after value become lower then LowValue. For sell order I would like that order will be open as soon as Bid become lower then LowValue.

 

you need have your order placement code executing every tick. at the moment it will only place an order on the bar open provided that the open is above or below the entry.

int start()

{

//on the bar open get high and low

{

if(got_high_and_low)

{

readytotrade = true;

}

}

//every tick, if ready to trade, check that the entry price has been hit

if(readytotrade)

{

//buy or sell

readytotrade = false;

}

}

 
fxcourt:
you need have your order placement code executing every tick. at the moment it will only place an order on the bar open provided that the open is above or below the entry.

Hm, and how I do this?

 

You will need to re-structure your code. shouldnt be too hard. just split it into two parts. the first part executes once per bar to gather your entry and other data, the second part will watch for the entry to be hit.

 
fxcourt:

you need have your order placement code executing every tick. at the moment it will only place an order on the bar open provided that the open is above or below the entry.

int start()

{

//on the bar open get high and low

{

if(got_high_and_low)

{

readytotrade = true;

}

}

//every tick, if ready to trade, check that the entry price has been hit

if(readytotrade)

{

//buy or sell

readytotrade = false;

}

}

wuh, I'm little lost right now. More help will be great. ;)

Reason: