Announcement

Collapse
No announcement yet.

Barstate_newbar

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Barstate_newbar

    Quick question for the gurus...

    I want to record the values of the indicators upon the first - and only - the first tick. As I understand it, I should be using :

    if(getbarstate() == BARSTATE_NEWBAR){}

    The script uses colors to mark bars depending on the indicators and it runs without error. However, the current bar is blank and all bars from when I ran the script remain blank until I reload the script. In fact, I am not sure I trust the colors of the bars, historically as being the value of the indicators at first trade of bar open, as it looks a little too good to be true.

    Any hints for how to get it to color my bars on first tick and leave that color for the remainder of the bar despite how the indicator is at the end of the bar?

    Many thanks gurus!
    (attached, please find the script)
    Attached Files

  • #2
    Re: Barstate_newbar

    mlipham
    See the solution I provided in this thread in reply to a similar issue
    Also you need to add a setDefaultPriceBarColor(your color) statement in preMain or add a condition to color the price bars when neither preceeding condition is true
    Alex


    Originally posted by mlipham
    Quick question for the gurus...

    I want to record the values of the indicators upon the first - and only - the first tick. As I understand it, I should be using :

    if(getbarstate() == BARSTATE_NEWBAR){}

    The script uses colors to mark bars depending on the indicators and it runs without error. However, the current bar is blank and all bars from when I ran the script remain blank until I reload the script. In fact, I am not sure I trust the colors of the bars, historically as being the value of the indicators at first trade of bar open, as it looks a little too good to be true.

    Any hints for how to get it to color my bars on first tick and leave that color for the remainder of the bar despite how the indicator is at the end of the bar?

    Many thanks gurus!
    (attached, please find the script)

    Comment


    • #3
      That's it!

      That solved it. Thanks for taking the time.
      Now, if only I could figure out how to make it go the way I think it will, each time. If I figure THAT out, I'll let you know. =)

      Comment


      • #4
        Re: That's it!

        mlipham
        You are most welcome
        Alex


        Originally posted by mlipham
        That solved it. Thanks for taking the time.
        Now, if only I could figure out how to make it go the way I think it will, each time. If I figure THAT out, I'll let you know. =)

        Comment

        Working...
        X