How to get price just before close yesterday

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #71398 quote
    teapot2002
    Participant
    Average

    Hi – I’m very new to this, so please forgive me for my ignorance. I am trying to code a simple strategy that looks at the price of the FTSE yesterday just before close, so at 16:29:59, and takes the difference from today’s opening price at 08:00:01.

    Can anyone please help me with how I do this? I have spent quite a while looking at the TIME function, and OPEN and CLOSE, but I can’t work it out.

    Many thanks.

    #71400 quote
    robertogozzi
    Moderator
    Master

    Since you want to compute the difference between two adjacent bars, you can simply write

    IF IntradayBarIndex = 0 then      //on the very first bar of the new day...
       Difference = open - close[1]   //...compute the difference between CURRENT open and PREVIOUS close
    ENDIF

    this solution works with every intraday TF.

    If you need to have exactly the values at 16:29:59 and at 08:00:01, you’ll have to use the 1-second TF and write this piece of code:

    IF time = 162929 THEN
       ClosingPrice = close
    ENDIF
    IF time = 080001 then
       Difference = open - ClosingPrice
    ENDIF
    teapot2002, immo_vienna and Nicolas thanked this post
    #71403 quote
    teapot2002
    Participant
    Average

    That’s completely brilliant, Roberto, thank you so much.

    Helen

    #71405 quote
    Vonasi
    Moderator
    Master

    This is not really a PRT Platform issue but more of ProOrder auto-trading issue. Now that Robert has provided the solution I have moved it across to the ProOrder section of the Forum where it is a bit more relevant. Please try to post in the correct section of the forum when you have future requests or questions so that you will find the best chance of an answer. 🙂

    #71452 quote
    immo_vienna
    Participant
    Average

    @ robertogozzi

    does this work in 1min timeframe too? or just in intraday?

    thx for help!

    #71453 quote
    robertogozzi
    Moderator
    Master

    1 minute IS intraday, so it will work perfectly.

    #71465 quote
    immo_vienna
    Participant
    Average

    thank you!

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

How to get price just before close yesterday


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
teapot2002 @teapot2002 Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by immo_vienna
7 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/26/2018
Status: Active
Attachments: No files
Logo Logo
Loading...