Don't want to use DAX afterhours session to calculate indicators
Forums › ProRealTime English forum › ProOrder support › Don't want to use DAX afterhours session to calculate indicators
- This topic has 11 replies, 2 voices, and was last updated 5 years ago by Seb.
-
-
07/04/2018 at 2:55 PM #75215
Hello, as some of you know IG has a trading session overnight for DAX outside of the regular futures session (08:00-22:00). The issue I have is that I want to plot the bars of this extra IG session, but I don’t want to use the OHLC data of those bars for my indicators for backtesting purposes. Does anybody know a solution for this?
07/05/2018 at 7:13 AM #75246For accurate calculation, it would be great to make personal arrays of data, and apply calculation of each of the indicators you are using on them, but it is not possible. However, there are 2 possibilities:
- use a time condition to allow or not your variables to be populated or not with the price data (the easy way, but not the more accurate one …)
- deconstruct all your indicators’ codes, make loops in the past, add time conditions to jump other not desired datas, and inject OHLC into indis calculation (the hard way but the better, but with limitations and a very painful work…).
1 user thanked author for this post.
07/05/2018 at 9:36 AM #7526707/05/2018 at 10:15 AM #7527407/05/2018 at 11:21 AM #75285ok, so to be clear, with the Donchian channel, let’s say of 20 periods, do you want to use the yesterday’s bars (before 220000 yesterday) for the calculation of the first 20 periods of the day (after 080000)?
exactly!
07/05/2018 at 12:12 PM #75304Ok, this should work, please let’s try it and give feedbacks:
123456789101112131415161718192021222324252627282930313233343536defparam flatafter = 210000if longonmarket thenalreadybuy=1endifif shortonmarket thenalreadysell=1endifif intradaybarindex=0 thenalreadybuy=0alreadysell=0profit=strategyprofitendifif time = 061000 thenyh = highest[86](high)yL=lowest[86](low)os = 2*pipsizeendiftcondition = time>080000 and time<200000if tcondition and strategyprofit<=profit thenif close<yh+os and not alreadybuy thenbuy 1 contract at yh+os stopendifif close>yl+os and not alreadysell thensellshort 1 contract at yl-os stopendifendifset stop ploss 15set target pprofit 151 user thanked author for this post.
07/05/2018 at 12:52 PM #75310I tried the code, I changed “profit” to “profits” as profit is a function.
I graphed the “yh”, but this doesn’t update during the day as new highs are made (and your target or stop might be hit). you could use the normal highest[20](high) after the first 20 bars after 08:00. Until that you must count “x” up to 20 with the highest[x](high) to compare with “yh” if you want to be accurate.
Thanks for this idea!
07/05/2018 at 2:03 PM #7533207/05/2018 at 2:28 PM #7533907/05/2018 at 2:31 PM #75340I need to rest a bit! Too hot near a computer 🙂
123456789101112131415161718period = 20tcondition = time>=080000 and time<220000hh=0ll=close*100count=0for i = 0 to barindex doif tcondition[i] thenhh=max(hh,high[i])ll=min(ll,low[i])count=count+1if count=period thenbreakendifendifnextreturn hh,ll07/05/2018 at 3:36 PM #7536407/06/2018 at 2:08 PM #75481 -
AuthorPosts