0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Pre-Market Volatility
[Re: Sundance]
#427009
08/01/13 08:42
08/01/13 08:42
|
Joined: May 2013
Posts: 245
swingtraderkk
Member
|
Member
Joined: May 2013
Posts: 245
|
@royal Does the original strategy intend that pending long and short orders are hit within the hour, or does it intend that only long or only short orders are hit? If the latter then you need a function to cancel the pending opposite orders if one is hit. I think you will need a trade management function for that as it will have to be executed at each tick and cannot be done at the end of each hour. I also think that you need a TimeWait = 1; so that the pending orders don't hang around forever and are only entered between 8 & 9. Also what 8 o'clock do you want the strategy to run is it 8am CET,GMT,UTC? @jcl For clarification: When you set Barperiod = 60 does that default to ending the bars at 00 minutes 00 seconds or does this need to be explicitly specified? The manual states that:
hour (int offset): int
Closing UTC hour of the given bar, 0..23. hour(0) gives the current hour and can be used to apply different trade tactics in the New York, European, or Asia-Pacific session.
so hour(0) gives the current closing hour in UTC, so at a few milliseconds past 8am (when zorro runs after the close of the 7am - 8am bar) does this return 9 as the closing hour (end of the bar just started at 8am) or 8 as the closing hour of the bar just finished bar 0, that started at 7am but closed at 8? Does hour() return the same as hour(0)?
|
|
|
Re: Pre-Market Volatility
[Re: swingtraderkk]
#427022
08/01/13 10:10
08/01/13 10:10
|
Joined: Jul 2013
Posts: 75
royal
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2013
Posts: 75
|
Does the original strategy intend that pending long and short orders are hit within the hour, or does it intend that only long or only short orders are hit? If the latter then you need a function to cancel the pending opposite orders if one is hit. I think you will need a trade management function for that as it will have to be executed at each tick and cannot be done at the end of each hour.
Afaik only one direction should be traded, this is missing in the code. Also the entries and stoploss should not be fixed at 15,20,25 / 50 but pending on the 8-9 o'clock volatility of the last 22 trading days. I also think that you need a TimeWait = 1; so that the pending orders don't hang around forever and are only entered between 8 & 9. The pending orders are cancelled after 9 o'clock, this is working as I see in the Logfile. Also what 8 o'clock do you want the strategy to run is it 8am CET,GMT,UTC? It's 8 o'clock German time, so CET i think
|
|
|
Re: Pre-Market Volatility
[Re: Sundance]
#427032
08/01/13 11:56
08/01/13 11:56
|
Joined: May 2013
Posts: 245
swingtraderkk
Member
|
Member
Joined: May 2013
Posts: 245
|
hour(0) is the same as hour(). It's the closing time of the current bar, and also the current time at the moment when the script is executed. The start time of the current bar would be hour(1).
Sorry jcl the limited brain is still confused. In this example, we want the script to execute at some microseconds past 06:00 UTC. The current time when the script executes is not the same as the current bar, my understanding is that the current bar is bar zero, i.e. the most recently fully completed bar. In the rest of zorro, bar number 0 is the bar just closed i.e. 05:00:00 to 06:00:00, so is the closing time of bar 0 = 06:00:00 and hour(0)=6? However, where I get confused is because the current time the script is running is now in a new bar not fully formed you could say bar -1, running from 06:00:00 to 07:00:00, in that case the closing time of the bar the script is running in is 07:00:00 and should hour()=7? So for our current script example is the correct statement to allow for daylight saving:
if (lhour(CET,0) == 8 or 9)
Last edited by swingtraderkk; 08/01/13 11:56.
|
|
|
Re: Pre-Market Volatility
[Re: Sundance]
#427039
08/01/13 12:47
08/01/13 12:47
|
Joined: May 2013
Posts: 245
swingtraderkk
Member
|
Member
Joined: May 2013
Posts: 245
|
In this thread jcl indicates that price(0) is from the bar just closed. This raises another question though, when writing a trade management function, that will be executed on ticks in a new bar forming, is there a difference between price() and price(0)? This was easier to get my head around in metatrader where the scripts ran on each tick and the last completed bar was 1 and anything in the current bar was 0. Zorro may function like metatrader in the functions that execute at a tick level, but normally the scripts execute immediately after a barperiod closes and I suppose theoretically before anything happens in the new barperiod that would need reference to.
Last edited by swingtraderkk; 08/01/13 12:56.
|
|
|
|