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

    Hi,

    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.

    #206711

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

     

    #206712

    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.

    #206713

    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.

    #206716

    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…

     

     

    #206718
    JS

    Hi @fonsie

    You can use something like that…

    #206719

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

    Much appreciated!!

    #206722

    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?

    #206726
    JS

    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…

    #206729

    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