Time problem – 5min early

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #73505 quote
    OllieB
    Participant
    Junior

    Hi

    I am trying to get the market value at 10.10am using the 5min timeframe, but my code returns the time from 10.05.  Can anyone help please??

    I use the following variables…

    marketopentime = 080000 //market open time
    marketclosetime = 163000  //market close time
    stratstarttime    = 101000    //start time of strategy in HHMMSS format
    risktime = 101500                 //time that stop can be calculated and applied
    validitytime = 102000         //stop time of strategy in time format (HHMMSS)

    Then I do the following logic check…

    if time >= stratstarttime and time < risktime then
    
    // Check and enter trade param
    
    stratopen = open

    But when I graph the “stratopen” value it returns the open value from the 10.05 candle, not the required 10.10 candle.

     

    Any help please?

    Thanks.

    #73507 quote
    Vonasi
    Moderator
    Master

    Welcome to the forums. Please use the ‘Insert PRT code’ button when putting code in your posts. I will tidy your post up for you! 🙂

    I would advise reading the documentation here:

    https://www.prorealcode.com/prorealtime-documentation/

    There is a whole section on Time and Date.

    Also try using the GRAPH instruction with TIME and then you will see exactly what is returned for TIME for each bar.

    Maybe you should consider OPENTIME?

    #73508 quote
    Juan Salas
    Participant
    Master

    OllieB,

    You should try to move everything 5 mins early (stratstartime=100500), or maybe using stratstartime= opentime=101000

    Regards.

    #73519 quote
    OllieB
    Participant
    Junior

    Thanks, I will do some research.

    #73520 quote
    OllieB
    Participant
    Junior

    Thanks.

     

    I tried that but the trade didn’t trigger.  And I was interested in understanding the workings of PRT as to why the seemingly simple logic isn’t working.

    #73522 quote
    robertogozzi
    Moderator
    Master

    Replace time < risktime with

    time <= risktime
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Time problem – 5min early


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
OllieB @ollieb Participant
Summary

This topic contains 5 replies,
has 4 voices, and was last updated by robertogozzi
7 years, 8 months ago.

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