HOURLY BIAS
Forums › ProRealTime English forum › ProOrder support › HOURLY BIAS
- This topic has 8 replies, 5 voices, and was last updated 4 years ago by
robertogozzi.
-
-
11/06/2021 at 4:09 AM #181100
Hi Guys, I tried to write a code about hourly bias (from 00:00 to 10:00) but TS doesn’t open some trade.
It opened a trade at 01:00 and close at 02:00 CORRECT
no opened a trade at 02:00 and close at 03:00 UNCORRECT
It opened a trade at 03:00 and close at 04:00 CORRECT
no opened a trade at 04:00 and close at 05:00 UNCORRECT
can you help me?
BIAS CODE123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596Defparam CumulateOrders = falseDefparam FlatAfter = 210000Size = 1Chiusura = 1 //dopo una barraSabatoeDomenica = OpenDayofWeek = 6 or OpenDayofWeek = 7// dalle 00:00 alle 01:00IF not SabatoeDomenica and CurrentTime = 000000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 010000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 01:00 alle 02:00IF not SabatoeDomenica and CurrentTime = 010000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 020000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 02:00 alle 03:00IF not SabatoeDomenica and CurrentTime = 020000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 030000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 03:00 alle 04:00IF not SabatoeDomenica and CurrentTime = 030000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 040000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 04:00 alle 05:00IF not SabatoeDomenica and CurrentTime = 040000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 050000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 05:00 alle 06:00IF not SabatoeDomenica and CurrentTime = 050000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 060000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 06:00 alle 07:00IF not SabatoeDomenica and CurrentTime = 060000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 070000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 07:00 alle 08:00IF not SabatoeDomenica and CurrentTime = 070000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 080000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 08:00 alle 09:00IF not SabatoeDomenica and CurrentTime = 080000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 090000 THENSELL Size CONTRACTS AT MARKETENDIF//// dalle 09:00 alle 10:00IF not SabatoeDomenica and CurrentTime = 090000 THENBUY Size CONTRACTS AT MARKETENDIF//IF CurrentTime = 100000 THENSELL Size CONTRACTS AT MARKETENDIF//11/06/2021 at 4:39 AM #181102Do it everywhere like this and it will start to respond as expected :
1234567891011// dalle 00:00 alle 01:00JustTraded = 0IF not JustTraded and not SabatoeDomenica and CurrentTime = 000000 THENBUY Size CONTRACTS AT MARKETJustTraded = 1ENDIF//IF not JustTraded and CurrentTime = 010000 THENSELL Size CONTRACTS AT MARKETJustTraded = 1ENDIF11/06/2021 at 9:54 AM #18110711/06/2021 at 10:22 AM #181112Sunday is 0, not 7.
11/06/2021 at 3:19 PM #181130I Tried this way but the problem is the same.
11/06/2021 at 3:44 PM #181131try this
12345678910td = opendayofweek = 1 or opendayofweek = 2 or opendayofweek = 3 or opendayofweek = 4 or opendayofweek = 5tt = time >= 000000 and time <= 090000If not onmarket and td and tt thenbuy at marketEndifIf onmarket thensell at marketEndif11/06/2021 at 4:08 PM #181132The OnMarket status is updated the bar AFTER a trade is closed, so line 18 will not be executed at 010000 since a trade has just been closed but will be reported next bar, at 011500, so it will be skipped. There can’t be 2 trades opened at the same time.
This is because you set line 1 to FALSE. Set it to TRUE, instead.
11/06/2021 at 6:25 PM #181144It’s the same, it doesn’t works.
11/07/2021 at 12:17 PM #181161Firstly, OpenDayOfWeek changes when the DAILY candle changes, so:
- now, without DST, it changes at 00:00 (Utc+1) at the same time the DAY changes
- when DST is active, it changes at 01:00 (Utc+2), while the DAY changes as usual at 00:00 (Utc+1), so there’s ONE whole hour when it’s reported as a new DAY, but as the old DAYOFWEEK. Adding GRAPH OpenDayOfWeek will help spot it on Mondays, when the 00:00 trade is never opened.
Secondly, as I said in my previous post, ProOrder needs a whole bar to be aware of any update uf the OnMarket status, so when at 02:00 you want to close a trade, it DOES, but it can’t open a new one because the confirmation of the exit will be received from the broker after the new bar has started forming and can be dealt with only when it closes. If you replace any BUY time with minute 1500 (or 0100 if you use a 1-minute TF) instead of 0000, everything will run smoothly.
-
AuthorPosts
Find exclusive trading pro-tools on