Calling an indicator from a system

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #162189 quote
    umebon
    Participant
    Average

    Is it possible too write an indicator with different timeframes and then call “Long” from a system? Cant get this too work out as I want.

    // ============================= Variabler för olika tidsintervall
    TIMEFRAME(1 hours,updateonclose)
    ma1 = average[20](close)
    c11 = ma1 > ma1[1] // Lång position
    
    TIMEFRAME(30 minutes,updateonclose)
    ma304 = Average[4](typicalPrice)
    ma308 = Average[8](typicalPrice)
    c301 = ma304 > ma308 // Lång position
    
    TIMEFRAME(15 minutes,updateonclose)
    indicator2 = Average[4](typicalPrice)
    indicator3 = Average[8](typicalPrice)
    c151 = (indicator2 > indicator3) // Lång position
    
    TIMEFRAME(10 minutes,updateonclose)
    indicator4 = SuperTrend[1.4,6]
    c101 = close > indicator4  // Lång position
    
    TIMEFRAME(5 minutes,updateonclose)
    ma5 = average[20](typicalPrice)
    c51 = ma5 > ma5[1] // Lång position
    
    IF c11 AND c301 AND c151 AND c101 AND c51 THEN
    LONG = 1                                  
    ENDIF
    
    return LONG AS "LONG"
    #162195 quote
    Vonasi
    Moderator
    Master

    Yes. Use the CALL instruction in your strategy.

    CALL

    However it is normally easier and more efficient just to hard code the indicator into your strategy.

    Also remember that you will need to run the strategy in a time frame that is compatible with the fastest time frame used in your indicator.

    Note: I gave your topic a more meaningful title – please try to use more descriptive titles with future topics.

    #162198 quote
    umebon
    Participant
    Average

    Just checking so I understand you right. The code is OK and all I need to is to call the indicator in the system.

    #162235 quote
    Vonasi
    Moderator
    Master

    Yes.

    Personally I would just cut and paste the code (removing the RETURN line) into a strategy and then replace LONG = 1 on line 25 with BUY 1 CONTRACT AT MARKET thus avoiding using the CALL instruction entirely.

    umebon thanked this post
    #162236 quote
    umebon
    Participant
    Average

    I´m trying too practice too build an indicator too call and how it works. My indicator is more detailed then the one I posted here but i can’t get the easy one too work.

    #162237 quote
    umebon
    Participant
    Average

    I get “pro backtest.error.parsing” sometimes when I try too run a system calling an indicator. What is wrong when that happens?

    #162241 quote
    umebon
    Participant
    Average

    Even if I make a simple system as this ProRealTime give me a probacktest.error.parsing. Is it just me that have that problem?

    I contacted ProRealTime but they don’t answer me… is this a known problem or am I doing something wrong?

     

    c11 = close crosses over average[20]
    return c11 AS "c11"
    DEFPARAM CumulateOrders = false
    c11 = CALL "suck" 
    IF c11 THEN
    BUY 1 Contract AT Market
    ENDIF
    #162244 quote
    Vonasi
    Moderator
    Master

    I just tested your code and it worked fine on my platform on the DJI daily chart.

    #162245 quote
    umebon
    Participant
    Average

    I run it on DAX 5m and i can’t get it too work, suspect

    #162246 quote
    umebon
    Participant
    Average

    I get parsing error sometimes when I run a indicator to a system. What is a parsing error?

    #162247 quote
    Vonasi
    Moderator
    Master

    There was a discussion in the French forum last October about similar issues.

    probacktest.error.parsing

    The best work around is to avoid using CALL and hard code the indicator in your strategy for the time being.

    umebon thanked this post
    #162248 quote
    umebon
    Participant
    Average

    But if I want to sell a system and want too hide the code doesn’t I have too put in a indicator and call it from a system or is there any other way too do it?

    #162250 quote
    Vonasi
    Moderator
    Master

    Yes that is the best way to do it. We may have to wait for PRT to investigate and fix this ‘parsing’ error before being able to code in this way though.

    Out of interest I just tested your simple test code on the DAX 5m and it worked just fine for me.

    umebon thanked this post
    #162251 quote
    umebon
    Participant
    Average

    I still have the error but thanx for the help for now. It is a little bit annoying when this appears but i guess it is just too wait out any solutions…

    #162254 quote
    umebon
    Participant
    Average

    When i change in my indicator it doesnt update, how do I save? Isnt autosave?

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

Calling an indicator from a system


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

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

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