DI+, DI- Indicator values for Brent Crude in ProReal Code different from chart
Forums › ProRealTime English forum › ProBuilder support › DI+, DI- Indicator values for Brent Crude in ProReal Code different from chart
- This topic has 3 replies, 2 voices, and was last updated 4 years ago by Nicolas.
-
-
06/12/2020 at 1:32 PM #135736Hi All,123456789101112131415161718192021222324252627282930313233// code To Ignore Buy TradeTIMEFRAME(5 minutes)iindicator1 = DIplus[10](close)iindicator2 = DIminus[10](close)cc1 = (iindicator1 < iindicator2)TIMEFRAME(15 minutes)iindicator3 = DIplus[10](close)iindicator4 = DIminus[10](close)cc2 = (iindicator3 < iindicator4)TIMEFRAME(30 minutes)iindicator5 = DIplus[10](close)iindicator55 = DIminus[10](close)cc3 = (iindicator5 < iindicator55)TIMEFRAME(1 hour)iindicator66 = DIplus[10](close)iindicator666 = DIminus[10](close)cc4 = (iindicator66 < iindicator666)GRAPH iindicator1 AS " 5 minute DI+"GRAPH iindicator2 AS " 5 minute DI-"GRAPH iindicator3 AS " 15 minute DI+"GRAPH iindicator4 AS " 15 minute DI-"GRAPH iindicator5 AS " 30 minute DI+"GRAPH iindicator55 AS " 30 minute DI-"GRAPH iindicator66 AS " 1 HOUR DI+"GRAPH iindicator666 AS " 1 HOUR DI-"IF NOT (cc1 or cc2 or cc3 or cc4 )THENBUY 1 PERPOINT AT MARKETENDIF=============================================================================Please can someone help me as to why the code above executes a buy of Brent Crude for the period of 10th June 07:05 to 07:07, when nearly all the DI+,DI minus timeframes are false from the charts but the backtest picks up the trade.
I used the graph function to check the DI + and DI minus values within backtest.
For 10th June 07:05:
Chart values:
5 mins DI+ 25.89869
5 mins DI- 18.47363
15 mins DI+ 20.96073
15 mins DI- 22.66533
30 mins DI+ 17.86417
30 mins DI- 26.54380
1hour DI+ 21.27028
1hour DI- 25.51226
Debug values of DI+ and DI- indicator values below using Graph functions
5 mins DI+ 25.89869
5 mins DI- 18.47363
15 mins DI+ 20.96073
15 mins DI- 22.66533
30 mins DI+ 17.86417
30 mins DI- 26.54380
1hour DI+ 21.27028
1hour DI- 25.51226Many thanks06/12/2020 at 1:40 PM #135737Did you graph your condition?
1GRAPH (cc1 or cc2 or cc3 or cc4 )if it returns 0 (false), then a buy order is triggered.
when nearly all the DI+,DI
Not nearly, all of them must be false.
06/12/2020 at 1:56 PM #135741The initial problem was this code with DI+ and DI- on the 5min, 15 min, 30 min and 1hour time frames was added to ignore a buy trade. I noticed from the charts for the date and time that with the exception of the 5mins time frame, the 15min, 30 min and 1hour time frames on the chart had their DI+ less than DI-, hence with the NOT (cc1 or cc2 or cc3 or cc4 ) condition, the trade shouldnt have been executed.
Hence used the graph function to graph the cc1,cc2, cc3, cc4 initially and realised they were all false within pro real code and then decided to graph the indicator values themselves and realised the values from prorealcode were different from the chart in prorealtime, resulting in all of them being false, hence reason why backtesting was behaving same way as my Auto trader code.
Hence my question is why the indicator value is very different from the chart ? Is there another syntax for DI+, DI minus Indicators?
Many Thanks
06/15/2020 at 9:05 AM #135970You are not using “updateonclose”, so the values from your indicators are the ones intrabar and not the ones fixed at Close that you can see on your chart.
Further explanation: First approach to multi timeframe trading with ProRealTime
-
AuthorPosts