Daily Moving Average with (CustomClose?) on non Daily Timeframe

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #10826 quote
    David
    Participant
    Veteran

    At this stage ProRealtime doesn’t have multi timeframe capabilities. However one easy possibility I thought would be to use the moving average of the daily timeframe with the options of DOpen, DHigh, DLow, DClose on another timeframe but I’m not convinced it works. Hopefully this might be useful and someone else can check it.

    I tried to add CustomClose but I don’t think that’s possible because then it would calculate the current timeframe of the moving average

    Also how do you get it to display in the Price window? I worked this out. You click the Wrench and Add Indicator that way!

     

    // Please note if you're using IG there's a smaller number of days you can use and the smaller the timeframe the small number of days you can use
    periods = p // days
    
    LMA=0 // Loop MA
    FOR i = 0 TO periods-1 DO  // Need -1 so the Result is the number of periods we actaully want
    LMA = DClose(i) + LMA // DOn't think this is possible CustomClose[(i)]
    Next
    
    LMAactual = (LMA / (periods))
    
    RETURN LMAactual+MA AS "Daily MA"
    #10956 quote
    David
    Participant
    Veteran

    Unfortunately this code has live limitations due to the:

    DEFPARAM PRELOADBARS = 50000 // max
    
    It will work on higher time frames ok but on m1 you're limited to use 3 days max :(

    I think my time with PRT is going to be short lived.

    #10967 quote
    Nicolas
    Keymaster
    Master

    Well done dwgfx. This code deserve to be posted to the library! 🙂

    #11013 quote
    David
    Participant
    Veteran

    Thanks Nicolas. I will submit it to the Library.

    I’m still not sure what the second numeral can be used for during optimization. The documentation says:

    Personal Indicators

    It is possible to call ProBuilder indicators that you have programmed using the “CALL” instruction in a trading system.

    Example:

    a,b = CALL “HistoMACD[5,6]” // a and b are the outputs of the function. 5 & 6 are the inputs.

    To learn more about optimal use of the CALL function, read the section dedicated to optimizing your programs carefully.

    But I can’t find this section in the documentation “optimizing your programs carefully”?

    #11016 quote
    Nicolas
    Keymaster
    Master

    I’m sorry but I can’t understand your question about the second “numeral”? 😐

    #11019 quote
    David
    Participant
    Veteran

    For example in the above there’s

    a,b = CALL “HistoMACD[5,6]” // a and b are the outputs of the function. 5 & 6 are the inputs.

    1. why is there “a,b”

    When you add my Daily Moving Average to a system it shows

    indicator2 = CALL “01 Daily Moving Average”[48, 0]

    2. I know 48 is the actual moving average but what is the “0” for?

    #11037 quote
    Nicolas
    Keymaster
    Master

    a and b are the variables returned by the indicator you are Calling in its RETURN instruction.

    0 is a parameter of your indicator obviously, maybe you use custom close for your moving average calculation?

    #18761 quote
    David
    Participant
    Veteran

    Hi Nicolas

    I was going to upload this to the Indicator Code Library but I keep getting a HTTP error when I try with Firefox and Chrome?

    I guess you can add it?

    Title: Moving Average Daily

    At this stage ProRealtime doesn’t have multi timeframe capabilities. However one easy possibility is to use the moving average of the daily timeframe with the options of DOpen, DHigh, DLow, DClose and that’s what this indicator enables you to do.

    You can select the number of periods ie. Days:

    number of periods/days (please note there’s a limit depending on the timeframe you use this on and there’s a difference between PRT and IG data periods)
    open/high/low/close, etc…

    If you are going to use this in a live trading account you will need to set:

    DEFPARAM Preloadbars =

    Here is the table of how much Preloadbars you will need depending how many periods you want to look back.  The column max days shows the maximum of what you can set Preload to. As an example of you are using a 10 minute timeframe the maximum DEFPARAM Preloadbars = 35 // you can only have moving average of 35 days maximum.

    DEFPARAM Preloadbars =
    60 24 5000
    Minutes bars per hour bars per day max days
    1 60 1440 3
    5 12 288 17
    10 6 144 35
    15 4 96 52
    30 2 48 104
    60 1 24 208
    #18793 quote
    Nicolas
    Keymaster
    Master

    Hey David, thanks a lot for your code sharing. I were not aware of this bug, thanks for letting me know it! it is now fixed. Would you mind re-test your code submit please? I would be thankful!! 🙂

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

Daily Moving Average with (CustomClose?) on non Daily Timeframe


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
David @dwgfx Participant
Summary

This topic contains 8 replies,
has 2 voices, and was last updated by Nicolas
9 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/23/2016
Status: Active
Attachments: No files
Logo Logo
Loading...