Does the TIMEFRAME keyword accept numeric constants only?
Forums › ProRealTime English forum › ProBuilder support › Does the TIMEFRAME keyword accept numeric constants only?
- This topic has 7 replies, 3 voices, and was last updated 1 year ago by robertogozzi.
Tagged: mtf, mtf indicators
-
-
09/30/2022 at 10:00 AM #201701
How can I store a timeframe value in a variable?
I have tried the following code, but it is not accepted:
12345678910111213tf1 = 5 minutestf2 = 15 minutes//timeframe tf1timeframe (tf1)tf1myMACD=exponentialaverage[12]-exponentialaverage[26]//timeframe tf2timeframe (tf2)tf2myMACD=exponentialaverage[12]-exponentialaverage[26]timeframe (default)return tf1myMACD, tf2myMACDThanks for your support.
Walter09/30/2022 at 10:43 AM #201702You 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.
12/21/2022 at 7:39 AM #206113Somehow 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.
12/21/2022 at 12:43 PM #206134I 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.
12/21/2022 at 2:18 PM #206146My 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.
12/21/2022 at 2:44 PM #20614912/21/2022 at 3:29 PM #20615412/21/2022 at 4:51 PM #206156It’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.
-
AuthorPosts
Find exclusive trading pro-tools on