Invalidate a specific date in a indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #166314 quote
    umebonumebon
    Participant
    Average

    Hi

    If I want too invalidate a system after a specific date in a indicator how do I get it right in the system? If I do it like this the backtest shows different result with and without the “Aktiv”. Whats wrong??

    IF OpenDate > 20210501 THEN //Stoppdatum i maj
    Datum = 0               //Invalidera alla signaler
    ENDIF
    
    return Datum AS "Datum"
    Datum = CALL "Indicator"
    Aktiv = Datum >= 1
    
    TaPosition =  c11 AND c12 AND c13 AND Aktiv
    
    IF TaPosition THEN
    BUY positionStorlek CONTRACT AT MARKET
    ENDIF
    #166318 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Your indicator should be:

    Datum = 1
    IF OpenDate > 20210501 THEN //Stoppdatum i maj
       Datum = 0                //Invalidera alla signaler
    ENDIF

    Otherwise DATUM will never retain value 1.

    umebon thanked this post
    #166322 quote
    umebonumebon
    Participant
    Average

    Thanks, missed that. But why do I get different backtest results when I use “Aktiv” in “TaPosition”?

    #166323 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    If you are using very low TF’s, such as a few seconds, it might be that the period has canged, while you were modifying your code, so a different period will yield different results.

    In any case only the real code may be investigated.

    #166324 quote
    umebonumebon
    Participant
    Average

    I use 1h timeframe so thats not the problem.

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Invalidate a specific date in a indicator


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by umebonumebon
5 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/06/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...