Daily MA7 on smaller timeframe

Forums ProRealTime English forum ProBuilder support Daily MA7 on smaller timeframe

This topic contains 10 replies, has 2 voices, and was last updated by avatar Vonasi 9 months, 2 weeks ago.

View all attachments
Viewing 11 posts - 1 through 11 (of 11 total)
  • #95729

    Hello I’m looking to code a daily  moving average(7)  on my intraday chart. I know there has been already topics on that in the past, but the particularity here is that I would like to take the closing price of a particular time, ie 17h35 for the Dax for example, corresponding to the cash close.  Any idea how to navigate with the past dates, and avoid the problem with the weekend, the new month etc??

     

    #95734

    So you want a seven period average of the closing price at 1735?

    You could just store the last seven values at close of 1735 candle. Each time there is a new one drop one of the old ones and record the new one.

    Another alternative is to code a dummy MTF strategy and then use GRAPHONPRICE to draw it on your intraday chart.

    I’m not sure what weekend or change of month issues you see happening?

    #95735

    Here is the first idea:

     

    #95736

    “So you want a seven period average of the closing price at 1735?”

    Yes

    seems simple but I have some difficulties in my head to work with dates.

    If you compare Date in YYYYMMDD, then rolling month complicates a bit the calculation

    #95741

    seems simple but I have some difficulties in my head to work with dates. If you compare Date in YYYYMMDD, then rolling month complicates a bit the calculation

    I don’t understand. What do dates and months have to do with it? There is only one 1735 everyday unless you have a time machine!?

    #95747

    Sorry I made my comment before seeing your code idea. I didn’t know that it was that easy and dates weren’t needed.

    Idea is good, even though what is missing is to make it more dynamic by taking the value of today into consideration. So the 6 last closes at 17h35, and the seventh value is the most current one

    #95748

    So now I have a bit modified your code, I need to check if this is correct

     

     

    #95749

    Your conditions in lines 1 and 7 can never be met.

    #95750

    Maybe you mean something like this?

     

    1 user thanked author for this post.
    #95752

    Indeed;)

    the price at 17h35 is the close price of the 17h30 candle on a 5min chart actually, so 17300 it should be for those who wish to use this little code snippet for scalping.

    #95753

    Yes OPENTIME is the time a candle opens and TIME is the time it closes. So if you want the exact price at 1735 then you can use OPEN and OPENTIME or use CLOSE and TIME. Both should return the same value unless there is a gap in price between CLOSE and OPEN.

    In a strategy TIME is used more often as decisions are made at the candle close and trades opened at the next candle open. In indicators generally OPENTIME is of more use as on the fly analysis of a candle is carried out from the moment it opens.

    I still find that sometimes I have to just put the following indicator on a chart to clarify things in my head when coding stuff:

     

Viewing 11 posts - 1 through 11 (of 11 total)

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