Store Indicator Value At Bar Open

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #83162 quote
    Ξ3
    Participant
    Average

    I am able to identify the opening tick of a new X-tick bar using the below code, but is there a way to store a value at this point in time?

    With each new tick that arrives, the value of my indicator changes but I would like to compare it to the value at the bar open (which will be different from the previous bar close value).

    As soon as the “NewBarOnChart” is false (from tick 2 onwards), I lose the opening value of my indicator. Can I somehow store it?

    // -> Bar On Chart
    CurrTime = CurrentTime + (10000 * TimeZoneAdjustment)
    LastBarOnChart = (Date = Today)
    LastBarOnChart = LastBarOnChart AND (CurrTime = OpenTime)
    LastBarOnChart = LastBarOnChart AND (Time >= CurrTime)
    NewBarOnChart = LastBarOnChart
    NewBarOnChart = NewBarOnChart AND (Time = OpenTime)

    #83184 quote
    Nicolas
    Keymaster
    Master

    This is a common problem because variables are reset at their default values, each new tick received, in the current bar.

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

Store Indicator Value At Bar Open


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Ξ3 @cbeukes Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
7 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/19/2018
Status: Active
Attachments: No files
Logo Logo
Loading...