Current Price in different timeframes

Forums ProRealTime English forum General trading discussions Current Price in different timeframes

Viewing 10 posts - 1 through 10 (of 10 total)
  • #206710


    First off i want to explain that i’m new to programming and to PRT so excuse me in advance. I’ve tried to find a solution now for a couple of days but have a hard time.

    I want to buy the close if the index is up more than X percent and above MA200 the same day and then sell the open the day after.

    The problem i’ve encountered is getting the current price before close and compare it from the previous days close. I came across the function timeframe and was thinking that using that in 5 min and update the price before close and then compare it with yesterdays price.

    Anyone have a good solution to this and what timeframe as default would you use for this solution?

    Sounds simple but i guess it’s not, thanks in advance.


    So, what do you want X% to be calculated on?



    I want X% to be calculated on yesterday’s close, just like they do with stocks.

    For example yesterday dax closed at 14070 and current price is 14255 and it is up 1.33%. So at today’s close if Dax is still up X% I want to buy to sell immediately at open tomorrow.


    This was what i thought would be correct but it’s not since i cant use timeframe 5 min then go back to daily candles.


    You can refer to daily constants Dopen(0), Dhigh(0), Dlow(0) and Dclose(0) to acces today’s daily data. Use (1) to refer to yesterday’s daily data, etc…




    Hi @fonsie

    You can use something like that…


    Thanks for the support and tips, i’ll give it a try!

    Much appreciated!!


    It works but the results are not that good 🙂

    Also i’m running it in 1hour timeframe but when backtesting i only get 30 total trades. Would like to expand the backtesting period, is it possible to do the same execution but in a daily timeframe?


    Hi @fonsie


    You can use the code in a daily time frame only then you can no longer use the times (Time)…

    The times (Time) are only triggered when you use a time frame of one hour…


    Actually you might use multiple time frames, so you can wait for some conditions to be met on a Daily TF and other ones on a smaller TF.


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

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