Calling indicator in different time frame

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #75992 quote
    JohnScher
    Participant
    Veteran

    I would like to set a filter from TimeFrame 4H in TimeFrame 1H.

    The position should only be opened in 1H, e.g. if the EMA50 is larger than the EMA1 in 4H.

    I use the call command, code:

    IF Exponentialaverage [50] (close) > Exponentialaverage [1] (close) then
    Long = 1
    Endif
    
    IF Exponentialaverage [50] (close) < Exponentialaverage [1] (close) then
    Long = -1
    Endif
    
    return Long
    

     

    And so I drag the condition from 4H to 1H.

     

     

    // OnlyShort-Strategy on Dax
    // Dax 1 Euro Mini
    // TimeFrame 1H
    // created by JohnScher
    
    
    //defparam flatafter = 210000
    defparam cumulateorders = false
    
    
    // define starttime
    TradingDayShort =  Opendayofweek = 1 //or Opendayofweek = 2 or Opendayofweek = 3 or Opendayofweek = 4 or Opendayofweek = 5
    TradingTimeShort =  time>= 110000 // or time = 120000 ... 
    
    
    
    c = call  "Timeframe"
    
    //maincode
    IF  TradingDayShort and TradingTimeShort and c = -1 Then
     sellshort 1 contracts at market
    ENDIF
    
    
    IF Shortonmarket and barindex - tradeindex >= 30  then 
    Exitshort at market
    ENDIF
    
    //set stop %loss 3
    //set target %profit TP
    
    // not tested
    // on other major indizes
    // with Saisonalpatternmultipler from Pathfinder-Systems
    // with some Re-invest-Stategies
    
    
    // until then
    // JohnScher
    

     

     

    a. Did I program that right?
    b. Is there an easier way to program, if so, how?

    #75995 quote
    Vonasi
    Moderator
    Master

    It does not call the indicator on a different time frame it calls it on the same time frame that your strategy is running on.

    It is probably easier to wait until Wednesday when hopefully PRT demo will have MTF to play with and then you can just put your indicator under a TIMEFRAME(4 hour) in the strategy.

    I have changed the title of your topic as it did not tell us what your question actually was. 🙂

    FREDNC thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Calling indicator in different time frame


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
JohnScher @johnscher Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Vonasi
7 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/14/2018
Status: Active
Attachments: No files
Logo Logo
Loading...