Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pricemarker not visible when use IsFirstTickOfBar and Calculate.OnEachTick

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

    Pricemarker not visible when use IsFirstTickOfBar and Calculate.OnEachTick

    no pricemarker can be seen with this code!
    Code:
    protected override void OnStateChange()
    {
       Calculate = Calculate.OnEachTick;
    }
    protected override void OnBarUpdate()
    {
       if (!IsFirstTickOfBar)
           return;
    
       Line[1] = CurrentBar == 0 ? Input[1] : (Input[1] * constant1) + (constant2 * Line[2]);
    }
    Click image for larger version

Name:	Screenshot_4.jpg
Views:	306
Size:	102.3 KB
ID:	1146552


    all ok with this code pricemarker is visible!
    Code:
    protected override void OnStateChange()
    {  
       Calculate = Calculate.OnBarClose;
    }
    protected override void OnBarUpdate()
    {
       Line[0] = CurrentBar == 0 ? Input[0] : (Input[0] * constant1) + (constant2 * Line[1]);
    }
    Click image for larger version

Name:	Screenshot_5.jpg
Views:	286
Size:	100.9 KB
ID:	1146553


    how can I set the indicator to OnEachTick and work with IsFirstTick so that the pricemarker is also visible?
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Let's start with the basics.

    Is 'Price marker(s)' checked in the indicator properties?

    Attached Files

    Comment


      #3
      yes it is checked
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Ok, great.

        In the OnEachTick version, does Line[0] ever get assigned a value?

        Typically, when using OnEachTick, the value in Line[0] would get
        recalculated over and over, getting stored back into the same slot,
        over and over -- until it gets set in concrete when the bar closes,
        because only when a bar closes is a new [0] slot created.

        Perhaps the Price Markers (which are associated with Plots) are
        only shown for the [0] values ... so if the Plot doesn't have a [0]
        value during OnEachTick, the Price Marker is not drawn ...

        Try this experiment:
        In the OnEachTick version, make sure Line[0] has a value.
        Is the Price Marker drawn at the value held by Line[0]?

        Comment


          #5
          Hi bltdavid, the tip with the line[0] was good and also well explained by you, thank you very much! good that there are people like you who have enough patience to help people like me a little bit
          I didn't realise that the line [1] doesn't work without the line [0], I thought that if the line is visible, the preicmarker must also be visible, but I was wrong.
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          330 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          548 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X