Does the TIMEFRAME keyword accept numeric constants only?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #201701 quote
    geier777geier777
    Participant
    New
    How can I store a timeframe value in a variable? I have tried the following code, but it is not accepted:
    tf1 = 5 minutes
    tf2 = 15 minutes
    
    //timeframe tf1
    timeframe (tf1)
    tf1myMACD=exponentialaverage[12]-exponentialaverage[26]
    
    //timeframe tf2
    timeframe (tf2)
    tf2myMACD=exponentialaverage[12]-exponentialaverage[26]
    
    timeframe (default)
    return tf1myMACD, tf2myMACD
    
    Thanks for your support. Walter
    #201702 quote
    PhilstradingPhilstrading
    Participant
    Senior
    You should create a new topic for that really However I dont think you can. You can create a variable within a timeframe and use that, but timeframe code itself can’t be stored differently as far as I’m aware. Best thread is https://www.prorealcode.com/blog/learning/approach-multi-timeframe-trading-prorealtime/   Generally you have to create your variables within the specified timeframes you want them in, but timeframes themselves are unable to be stored as variables… The logic of coding is to select the timeframe you want to get data from and use the variables within your code. The above thread will help to see how that can be used within the default timeframe being used.
    #206113 quote
    LivJoJadeLivJoJade
    Participant
    Junior
    Somehow I don’t think this is possible. I have written a probacktest and indicator (see attached) using 2hr, 1hr,30 minute and 15 minute timeframes. Each time I’m told to use a 5 minute timeframe because all timeframes are divisable by 5 minutes. I’ve also tried using the TIMEFRAME (default) command but alas, no joy. Is it possible guys? Many thanks in anticipation.
    MTF-Bolly-Ind.itf Bolly-PBT.itf
    #206134 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    @geier777 I created a new topic. Do not append different questions to existing topics, as suggested by Philstrading, as this would make it difficult to search the correct infos, when needed. Thanks 🙂 As stated in the prior post, it’s not possible to use variables with the TIMEFRAME keyword.
    #206146 quote
    LivJoJadeLivJoJade
    Participant
    Junior
    My apologies Robert. While off sick today I’ve played with the probacktest and am getting entries on the 15 minute chart, however the issue I’m now having is exit of positions, for some reason the backtest is not recognising the exit conditions. Many thanks in anticipation.
    Bolly.itf
    #206149 quote
    JSJS
    Participant
    Master

    Hi

    When I backtest your system “Bolly” on a time frame of 5 minutes then there are no problems…

    Both long and short trades…

    Scherm­afbeelding-2022-12-21-om-14.43.28.png Scherm­afbeelding-2022-12-21-om-14.43.28.png
    #206154 quote
    LivJoJadeLivJoJade
    Participant
    Junior
    good afternoon 1st of all many thanks for your reply. The code doesn’t seem to have an issue entering trades, it is the exit criteria. trades should be exited when the hourly close hits 50 RSI?
    #206156 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    It’s because of the missing UPDATEONCLOSE keyword (hence the DEFAULT keyword is assumed), as your chart will display a wrong RSI at closing time, while when the 1-hour bar is forming it happened to be in the correct range.
Viewing 8 posts - 1 through 8 (of 8 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

Does the TIMEFRAME keyword accept numeric constants only?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
geier777 @geier777 Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by robertogozzirobertogozzi
3 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/30/2022
Status: Active
Attachments: 4 files
ProRealCode ProRealCode
Loading...