How can I plot different moving averages on Monthly/Daily/Weekly

Forums ProRealTime English forum ProBuilder support How can I plot different moving averages on Monthly/Daily/Weekly

Viewing 15 posts - 1 through 15 (of 15 total)
  • #38089

    Hi

    Could someone please tell me how to make an indicator that will recognise what timeframe  I am viewing and plot different moving averages. I have tried the following formula but after a lot of googling I’m not sure if this is possible in ProBuilder.

     

     

    #38117

    Not possible to use “timeframe” in ProBuilder.

    To automatically find on which timeframe you are on, you can try to use this code snippet, it will return the minutes quantity (120 for a 2 hours timeframe for instance).

     

    1 user thanked author for this post.
    #38120

    Hi Nic

    Thanks for the help mate. I’ve only been using ProRealTime for a few days so I’m a bit green. I’m used to Amibroker and Metastock.

    How can I start writing the conditions based on that formula? Do I place that at the beginning of the formula and then start referencing to Timeframe?

    Alan

    #38129

    I use the following code to determine timeframe (daily/weekly/monthly)/ It is based on PRT’s time format: yyyymmdd (i.e. 20170612 for today) and bar-to-bar simple subtraction to detect the number of days between adjacent bars. The OR in each IF deal with weekends etc. This, of course, only work for swing trading

     

    2 users thanked author for this post.
    #38171

    Thanks Pinny

    I’m still having a bit of trouble. How many times can you add “Return” to an indicator. I’m getting an error and I’m not sure what to do.

     

    #38177

    You can only RETURN the variables once.

    You should have coded it like this:

    Please test it and tell us if it works! 🙂

    (there is not need to make double equal for testing like in other programming languages).

    1 user thanked author for this post.
    #38179

    Thanks Nic. I entered that code but I’m getting an error in line 26. Not sure why sorry.

     

    #38182

    I think its a EndIf issue, the following works:

     

     

    1 user thanked author for this post.
    #38183

    Thanks Pinny. I checked the manual and it seemed to use an Else for the last condition. Thanks heaps for the help. It works. After years of learning Amibroker and Metastock it seems I’m starting all over again!

    #38189

    Looks like there is still a small problem. It wasn’t plotting on the weekly when using “a=30″ so I changed it to ” a=7″ and it plots fine. The monthly was plotting fine but now that the weekly is set to “a=7” the monthly no longer plots

    #38193

    >> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

     

    1 user thanked author for this post.
    #38195

    Here is the whole formula. The monthly will not plot

    There is also a vertical line at the beginning of the ema. I use valuewhen in metastock to hide that but that doesn’t seem to be available in Probuilder. Is there a way to hide it?

     

    #38199
    Sorry, this is my documentation mistake – 1/daily, 7/Weekly, 30/Monthly, 100/Quarterly, 200/Annual
    Just use a=30 and this will plot on the Monthly (tried it:-)
    If (datedate[1])=1 OR (date[1]date[2])=1 Then
    a=1 // 1 signals Daily timeframe
    Endif
    If (datedate[1])=7 OR (date[1]date[2])=7 Then
    a=7 // 7 signals Weekly timeframe
    Endif
    If (datedate[1])=99 OR (date[1]date[2])=99 Then
    a=30 // 30 signals Weekly timeframe
    Endif
    If (datedate[1])=299 OR (date[1]date[2])=299 Then
    a=100 // 100 signals Monthly timeframe
    Endif
    If (datedate[1])>9500 Then
    a=200 // 200 signals Annual timeframe
    Endif
    If (a=100) Then
    ema1= ExponentialAverage[10](close)
    Elsif (a=7) Then
    ema1= ExponentialAverage[40](close)
    Elsif (a=1) Then
    ema1= ExponentialAverage[10](close)
    ema2= ExponentialAverage[50](close)
    ema3= ExponentialAverage[200](close)
    EndIf
    return ema1, ema2, ema3
    1 user thanked author for this post.
    #38200

     

    1 user thanked author for this post.
    #38201

    Thanks for all of the help. Its all plotting correctly now. This isn’t a problem but I would just like to know if there is a way to hide the vertical lines at the start of the EMA.

    Is there a function that I can use?

     

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

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