Indicator timeframe on chart with other timeframe

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5555 quote
    simon_json
    Participant
    Average

    Hi,

    I wish to use a MA which takes data from the 1H chart, but I want to run it on 1M chart, how  do I code it?

    I also wonder how to limit a code so it only takes one buy- and one sellshort-position per day?

    Thanks in advance!

    #5569 quote
    Eric
    Participant
    Master

    “I also wonder how to limit a code so it only takes one buy- and one sellshort-position per day?”

    I am also interested in this, using this code for example?

    // Definition of code parameters
    
    // Conditions to enter long positions
    indicator1 = Average[20](close)
    indicator2 = Average[50](close)
    c1 = (indicator1 > indicator2)
    
    IF c1 THEN
     BUY 1 SHARES AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator3 = Average[20](close)
    indicator4 = Average[50](close)
    c2 = (indicator3 < indicator4)
    
    IF c2 THEN
     SELL  AT MARKET
    ENDIF
    #5586 quote
    Nicolas
    Keymaster
    Master

    It’s easy, just count how many times your conditions to open a position is met in a variables ‘opensell’ and ‘openbuy’. Add a conditional request on this variables on your conditions to open trades and reset them on each new day.

    if intradaybarindex = 0 then 
     openbuy=0
     opensell=0
    endif
    
    // Definition of code parameters
    
    // Conditions to enter long positions
    indicator1 = Average[20](close)
    indicator2 = Average[50](close)
    c1 = (indicator1 > indicator2)
    
    IF c1 and openbuy=0 THEN
     BUY 1 SHARES AT MARKET
     openbuy = openbuy+1
    ENDIF
    
    // Conditions to exit long positions
    indicator3 = Average[20](close)
    indicator4 = Average[50](close)
    c2 = (indicator3 < indicator4)
    
    IF c2 THEN
     SELL  and opensell=0 AT MARKET
     opensell = opensell+1
    ENDIF
    #5606 quote
    simon_json
    Participant
    Average

    Thanks!

    #28727 quote
    wreini1982
    Participant
    Junior

    Hello,

    the original question was not answered, is it possible to trade in the M30, but use indicator from the H1 or H4?

    One way would be for example of course to calculate indicator or oszilator on your own based out of the smaller timeframe, but then once you run out of bars. 🙂

    Is there a function or code, like for example MovingAverage(H1, xy, xx,…) or something like this:)

    Best regards

    Wolfgang

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

Indicator timeframe on chart with other timeframe


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
simon_json @simon_json Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by wreini1982
8 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/18/2016
Status: Active
Attachments: No files
Logo Logo
Loading...