Error with historical data

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #145999 quote
    Tanou
    Participant
    Senior

    Hello,

    I keep getting one of my trading system rejected and I can sort it out…

     

    The error is “This trading system was stopped because the historical data loaded was insufficient to calculate at least one indicator during the evaluation of the last candlestick.” However, I don’t need much preloadbars for this system and I don’t see any mistakes.

     

    It is currently running on demo without problems and I was trying to implement it on the 10 seconds DAX 1€ and prt keep cutting it of for a reason that I don’t see…!

     

    I know that some of you already encountered this kind of problem and I already had a look at how it has been solved but I can’t relate my case to those as I don’t find the same mistakes!

     

    Thanks for your help 😀

     

    //-------------------------------------------------------------------------
    // Code principal : PPJ avec trailing stop v2
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Code principal : PPJ avec trailing stop v2
    //-------------------------------------------------------------------------
    DEFPARAM PRELOADBARS = 3000
    
    // Cumul des positions désactivé
    DEFPARAM CumulateOrders = False
    
    //************************************************************************
    
    //Horaires de trading
    // Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
    DEFPARAM FLATBEFORE = 080000
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 170000
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
    noEntryBeforeTime = 080000
    timeEnterBefore = time >= noEntryBeforeTime
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
    noEntryAfterTime = 170000
    timeEnterAfter = time < noEntryAfterTime
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    //************************************************************************
    
    IF Time < Time[1] THEN
    PlusHaut = High
    PlusBas = Low
    PP = (PlusHaut[1] + PlusBas[1] + Close[1]) / 3
    Premierpassage=0
    ELSE
    PlusHaut = Max(High,PlusHaut[1])
    PlusBas = Min(Low,PlusBas[1])
    PP = PP[1]
    
    ENDIF
    
    
    //************************************************************************
    
    // Conditions pour ouvrir une position acheteuse
    c1 = (close CROSSES UNDER pp)
    
    IF c1 AND timeEnterBefore AND timeEnterAfter AND Premierpassage=0 AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    Premierpassage=1
    SET STOP pLOSS 50
    ENDIF
    
    // Conditions pour ouvrir une position en vente à découvert
    c2 = (close CROSSES OVER pp)
    
    IF c2 AND timeEnterBefore AND timeEnterAfter AND Premierpassage=0 AND not daysForbiddenEntry THEN
    SELLSHORT 1 CONTRACT AT MARKET
    Premierpassage=1
    SET STOP pLOSS 50
    ENDIF
    
    
    //************************************************************************
    
    //trailing stop function
    trailingstart = 5 //trailing will start @trailinstart points profit
    trailingstep = 10 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
    newSL = tradeprice(1)+trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep THEN
    newSL = newSL+trailingstep
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
    newSL = tradeprice(1)-trailingstep
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep THEN
    newSL = newSL-trailingstep
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************
    
    #146009 quote
    robertogozzi
    Moderator
    Master

    Give your topic a meaningful title.Describe your question or your subject in your title. Do not use meaningless titles such as ‘Coding Help Needed’.

    Error is meaningless.

    Thank you 🙂

    #146012 quote
    Tanou
    Participant
    Senior

    Thanks robertogozzi! Should I create a new one or could I change it?

    By the way, do you have any suggestion regarding my problem? 🙂

    #146024 quote
    robertogozzi
    Moderator
    Master

    You can set preloaded bars to its maximum which is 10K, despite your code does not seem to need them.

    Don’t duplicate posts, leave them where they are and the way they are.

    #146025 quote
    Tanou
    Participant
    Senior

    Ok understood!

     

    However I already tried that and as you said it does not even require that amount.

     

    This is the problem and I can’t figure out what could be the problem… It keeps telling me that I don’t have enough preload bars. I think the problem is elsewhere but can’t figure out where. That’s why I came to you guys 🙂


    @Nicolas
    ?

    #146028 quote
    GraHal
    Participant
    Master

    Surely below will not work?

    Below may cause the Algo stoppage … despite what the error message says?

    You need the Trail Start to be more than the Trail Step (usually Start is several times the Step),

    trailingstart = 5 //trailing will start @trailinstart points profit
    trailingstep = 10 //trailing step to move the "stoploss"
    #146039 quote
    Nicolas
    Keymaster
    Master

    What is the PRT version please?

    #146051 quote
    Tanou
    Participant
    Senior

    Hello GraHal, Nicolas,

     

    Thanks for your proposal GraHal! However I already have som systems that are currently running and have that set up. Just to be sure I tried and same, the system is kicked out…

     


    @Nicolas
    , I’m currently in v10.3-1.8.0_202.  Do you think it could come from the plateform?

    GraHal thanked this post
    #146052 quote
    Nicolas
    Keymaster
    Master

    I’m just asking questions in order to get a complete picture 🙂

    Is the error message pop directly at start or later?

    Did you try with a “preloadbars = 0”?

    #146053 quote
    Tanou
    Participant
    Senior

    Oh ok 🙂

     

    Directly at start and I tried removing the trailing stop function, the time of entry, the date and nothing changes…

     

    I just tried with preloadbars = 0 and still out with the same error 🙁

    #146054 quote
    Tanou
    Participant
    Senior

    I tried removing part by part some of the code and seems to come from this part:

    ELSE
    PlusHaut = Max(High,PlusHaut[1])
    PlusBas = Min(Low,PlusBas[1])
    PP = PP[1]

     

    Do you know why?

     

    Thanks! 😀

    #146055 quote
    Nicolas
    Keymaster
    Master

    Try this, in this order, and make a test after each step if it solves the issue:

    1. remove the preloadbars line completely
    2. change the line 30 with: “if day<>day[1]”
    3. change the lines 46 and 55 by adding: “and pp>0” at the end of the lines (c1 and c2 conditions)
    #146056 quote
    Tanou
    Participant
    Senior

    With the second change it works, not with the other. However, when I do this change, the Daily PP isn’t correct anymore..

    #146059 quote
    Nicolas
    Keymaster
    Master

    Why not using a simplier daily pivot points formula:

    Ht = DHigh(1)
    Bs = DLow(1)
    C = DClose(1)
     
    Pivot = (Ht + Bs + C) / 3
    #146060 quote
    Tanou
    Participant
    Senior

    Because with this formula I don’t get the right PP..

    With this formula I get the right one

    IF Time < Time[1] THEN
    PlusHaut = High
    PlusBas = Low
    PP = (PlusHaut[1] + PlusBas[1] + Close[1]) / 3
    Premierpassage=0
    ELSE
    PlusHaut = Max(High,PlusHaut[1])
    PlusBas = Min(Low,PlusBas[1])
    PP = PP[1]
    
    ENDIF

    And with this one I get another daily pp which isn’t good

    Ht = DHigh(1)
    Bs = DLow(1)
    C = DClose(1)
     
    PP = (Ht + Bs + C) / 3
Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.

Error with historical data


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Tanou @tanou Participant
Summary

This topic contains 25 replies,
has 4 voices, and was last updated by Tanou
5 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/30/2020
Status: Active
Attachments: No files
Logo Logo
Loading...