Invalidate a specific date in a indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #166314 quote
    umebon
    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
    robertogozzi
    Moderator
    Master

    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
    umebon
    Participant
    Average

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

    #166323 quote
    robertogozzi
    Moderator
    Master

    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
    umebon
    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.

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 umebon
4 years, 10 months ago.

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