DI+, DI- Indicator values for Brent Crude in ProReal Code different from chart

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #135736 quote
    Zoroaster
    Participant
    New
    Hi All,
    // code To Ignore Buy Trade
    TIMEFRAME(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 )THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF

     

    =============================================================================
    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.51226
    Many thanks
    #135737 quote
    Nicolas
    Keymaster
    Master

    Did you graph your condition?

    GRAPH (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.

    #135741 quote
    Zoroaster
    Participant
    New

    The 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

    #135970 quote
    Nicolas
    Keymaster
    Master

    You 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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

DI+, DI- Indicator values for Brent Crude in ProReal Code different from chart


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Zoroaster @zoroaster Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Nicolas
5 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/12/2020
Status: Active
Attachments: No files
Logo Logo
Loading...