Help to encode an indicator and strategy based on performance of each hour
Forums › ProRealTime English forum › ProOrder support › Help to encode an indicator and strategy based on performance of each hour
- This topic has 21 replies, 4 voices, and was last updated 6 years ago by Vonasi.
-
-
12/10/2018 at 10:48 PM #86723
Dear guys,
I need support by encode a strategy based on the Dax (1h).
First of all I want to the check the outcome of each bar. That means an indicator to check each hour of the day.
The indicator:
Check the open and close of each bar (1h).
I want to see the performance of each hour of the day. Start from 8 am till 22.
Once we have the results we can try to build a strategy. See example attached. If we enter a position at 8 o’clock and exit at 12 o’clock to reach the best results.
As a filter we can use the Dfactor.
If we see that at certain time of the day the indices start to claim we can open a buy position.
I hope the explanation will be useful, otherwise feel free to ask.
Best regards, Giuseppe
12/11/2018 at 8:44 AM #86743There is an indicator in our library about the most active hours of the day, that you could analyze to take the trading decision: Most active hours of trading indicator
12/11/2018 at 8:53 AM #8674512/11/2018 at 9:13 AM #86747Thanks for pointing out that indicator Nicolas – I hadn’t spotted it in the library.
I notice though that the indicator calculates using HOUR and not OPENHOUR and so the results for say 16 are in fact the results for 1500 to 1600 and not the hour that starts at 1600
12/11/2018 at 7:06 PM #8687012/11/2018 at 7:10 PM #86872What about this new indicator https://www.prorealcode.com/prorealtime-indicators/most-active-hours-and-months/?
1 user thanked author for this post.
12/11/2018 at 7:21 PM #8687512/11/2018 at 7:37 PM #86876On a 1-hour TF:
1234567DEFPARAM CumulateOrders = FalseIF LongOnMarket THENSELL AT MARKETENDIFBUY 1 CONTRACT AT MARKETgraph STRATEGYPROFITgraph Rangesee attached pic.
12/11/2018 at 8:06 PM #86880I’m not sure that you are communicating what you want very clearly but then again my German is appalling!
Maybe this is the sort of idea you have. It is a version of my library indicator but it just totals up the balance of close minus open for every hour:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113//Most Active Hours//By Vonasi (thanks to throwaway200 for the idea)//20181211//defparam calculateonlastbars = 1000IF openhour = 0 THENH0 = (H0 + (close - open))H0Count = (H0Count + 1)ThisHour = (H0 / H0Count)drawvline(barindex) coloured(0,0,255)ELSIF openhour = 1 THENH1 = (H1 + (close - open))H1Count = (H1Count + 1)ThisHour = (H1 / H1Count)ELSIF openhour = 2 THENH2 = (H2 + (close - open))H2Count = (H2Count + 1)ThisHour = (H2 / H2Count)ELSIF openhour = 3 THENH3 = (H3 + (close - open))H3Count = (H3Count + 1)ThisHour = (H3 / H3Count)ELSIF openhour = 4 THENH4 = (H4 + (close - open))H4Count = (H4Count + 1)ThisHour = (H4 / H4Count)ELSIF openhour = 5 THENH5 = (H5 + (close - open))H5Count = (H5Count + 1)ThisHour = (H5 / H5Count)ELSIF openhour = 6 THENH6 = (H6 + (close - open))H6Count = (H6Count + 1)ThisHour = (H6 / H6Count)ELSIF openhour = 7 THENH7 = (H7 + (close - open))H7Count = (H7Count + 1)ThisHour = (H7 / H7Count)ELSIF openhour = 8 THENH8 = (H8 + (close - open))H8Count = (H8Count + 1)ThisHour = (H8 / H8Count)ELSIF openhour = 9 THENH9 = (H9 + (close - open))H9Count = (H9Count + 1)ThisHour = (H9 / H9Count)ELSIF openhour = 10 THENH10 = (H10 + (close - open))H10Count = (H10Count + 1)ThisHour = (H10 / H10Count)ELSIF openhour = 11 THENH11 = (H11 + (close - open))H11Count = (H11Count + 1)ThisHour = (H11 / H11Count)ELSIF openhour = 12 THENH12 = (H12 + (close - open))H12Count = (H12Count + 1)ThisHour = (H12 / H12Count)ELSIF openhour = 13 THENH13 = (H13 + (close - open))H13Count = (H13Count + 1)ThisHour = (H13 / H13Count)ELSIF openhour = 14 THENH14 = (H14 + (close - open))H14Count = (H14Count + 1)ThisHour = (H14 / H14Count)ELSIF openhour = 15 THENH15 = (H15 + (close - open))H15Count = (H15Count + 1)ThisHour = (H15 / H15Count)ELSIF openhour = 16 THENH16 = (H16 + (close - open))H16Count = (H16Count + 1)ThisHour = (H16 / H16Count)ELSIF openhour = 17 THENH17 = (H17 + (close - open))H17Count = (H17Count + 1)ThisHour = (H17 / H17Count)ELSIF openhour = 18 THENH18 = (H18 + (close - open))H18Count = (H18Count + 1)ThisHour = (H18 / H18Count)ELSIF openhour = 19 THENH19 = (H19 + (close - open))H19Count = (H19Count + 1)ThisHour = (H19 / H19Count)ELSIF openhour = 20 THENH20 = (H20 + (close - open))H20Count = (H20Count + 1)ThisHour = (H20 / H20Count)ELSIF openhour = 21 THENH21 = (H21 + (close - open))H21Count = (H21Count + 1)ThisHour = (H21 / H21Count)ELSIF openhour = 22 THENH22 = (H22 + (close - open))H22Count = (H22Count + 1)ThisHour = (H22 / H22Count)ELSIF openhour = 23 THENH23 = (H23 + (close - open))H23Count = (H23Count + 1)ThisHour = (H23 / H23Count)ENDIFavg = (h0 + h1 + h2 + h3 + h4 + h5 + h6 + h7 + h8 + h9 + h10 + h11 + h12 + h13 + h14 + h15 + h16 + h17 + h18 + h19 + h20 + h21 + h22 + h23)/(h0count + h1count + h2count + h3count + h4count + h5count + h6count + h7count + h8count + h9count + h10count + h11count + h12count + h13count + h14count + h15count + h16count + h17count + h18count + h19count + h20count + h21count + h22count + h23count)c = 155if ThisHour > Avg thenc = 255endifRETURN thishour coloured (100,149,237,c) style(histogram, 2) as "Average Range", avg coloured(0,0,255) style(line,1) as "All Time Average"12/11/2018 at 8:07 PM #86883sorry …. not whta I mean.
Which time of the day will be profitable.
Let me explain:
Day 1 of the Month
Hour 1 = Calculate Open at 010000 – Close at 020000
Hour 2 = Calculate Open at 020000 – Close at 030000
and so on…….
Day 2 of the Month
Hour 1 = Calculate Open at 010000 – Close at 020000 (cumulate of Day 1)
I hope it will be better ….
12/11/2018 at 8:08 PM #8688412/11/2018 at 8:11 PM #8688512/11/2018 at 9:25 PM #86891// Bedingungen zum Einstieg in Short-Positionen
IF NOT ShortOnMarket AND Time = 120000 THEN
SELLSHORT 5 CONTRACTS AT MARKET
ENDIF// Bedingungen zum Ausstieg aus Short-Positionen
IF ShortOnMarket AND time = 170000 THEN
EXITSHORT AT MARKET
ENDIF12/11/2018 at 9:31 PM #86894Isn’t that just pure data mining? You would need a long forward test to see if it works as well in the future as just matching it to history does.
You would be better to check each hour if it is a long or short profitable hour and how long that will last in the indicator and then do the same thing. Maybe adding in only trading in very active hours. Maybe this is something for me to test tomorrow but I fear history by the hour will not necessarily repeat in the future.
12/11/2018 at 9:36 PM #86895 -
AuthorPosts
Find exclusive trading pro-tools on