Multiple Timeframes in an indicator

Forums ProRealTime English forum ProBuilder support Multiple Timeframes in an indicator

  • This topic has 1 reply, 2 voices, and was last updated 1 day ago by avatardruby.
Viewing 2 posts - 1 through 2 (of 2 total)
  • #245472

    Hi

    Is it possible to have a higher timeframe moving average like the 4hr which then determines the value of a variable “Startime”

    Then use “Startime” in your lower timeframe like 5min.

    It gives me a parsing error when I then call the indicator function into my trading strategy.

    Timeframe(4hour,updateonclose)
    If Close<exponentialaverage[20]*0.985 Then
    Startime=090000
    else
    Startime=101500
    endif

    Timeframe(Default,updateonclose)
    If Time > Startime and Time < 133000 Then
    If Openhour > 9 and Close/Close[190]-1 > 1.25/100 Then
    TradeLong=0
    else
    TradeLong=1
    Endif
    If Openhour > 9 and Close/Close[190]-1 < -0.9/100 Then
    TradeShort=0
    else
    TradeShort=1
    Endif
    Endif

    #245474

    If the ‘call’ed indicator has the timeframe command in it, I think that causes the parse error.

    Its best to write the code directly in the strategy file, this avoids the longer execution times with the calling process.

    However, it can  work  if the TIMEFRAME command is in the strategy file and the call is from the timeframe block, but it will be longer to execute.

    Also the indicator file has to be suitably set up as a general indicator which works with any timeframe its put on.

    Keeping the execution time down , helps when back-testing.

    2 users thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login