Store opening price time 9am in a variable

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #138855 quote
    snow_onarsnow_onar
    Participant
    Senior

    Hello

    What is best practice to store the opening price at a specific time (ex. 090000 – 9am) in a variable

    I tried the following code:

    if time >= 090000 and time <= 090005 then
    myopenprice = open
    endif
    return myopenprice

    Thanks for your support.

    #138868 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I would say:

    IF time = 090000 OR (time > 090000 AND time[1] < 090000) THEN

    the first part (time = 090000) will be true whenever a bar closes at that time sharp, while the latter will be true whenever a bar does NOT close at 090000 sharp but it’s the first one to cross that time.

    snow_onar thanked this post
    #138987 quote
    snow_onarsnow_onar
    Participant
    Senior

    Thanks @robertogozzi

    The following solution is working for me:

    IF time = 090100 OR (time > 090100 AND time[1] < 090100) THEN
    myopendax = open
    endif
    
    IF time = 153100 OR (time > 153100 AND time[1] < 153100) THEN
    myopenus = open
    endif
    
    return myopendax coloured(255,255,0,255) style (dottedline,2), myopenus coloured(255,0,255,255) style (dottedline,2)
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Store opening price time 9am in a variable


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
snow_onar @snow_onar Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by snow_onarsnow_onar
6 years, 3 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 07/09/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...