Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time indicator development

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

    Time indicator development

    Is it possible to create a indicator that will give a alert when a stocks drops for like 5 days?


    So a stocks that see a lower closing prcve for 5 days. Can I get any help?

    Thx

    #2
    Hello Cube1984,

    Thank you for your note.

    To set up an indicator for when you have 5 down days/bars go to Control Center>New>NinjaScript Editor and right click on the indicator folder>New. Then you would add a check to make sure you have more than 5 bars of data and the conditions for lower closes, under OnBarUpdate().

    if (CurrentBars[0] < 5) return;

    if ((Close[0] < Close[1])
    && (Close[1] < Close[2])
    && (Close[2] < Close[3])
    && (Close[3] < Close[4])
    && (Close[4] < Close[5]))
    {
    Draw.ArrowDown(this, @"tStocksDrop5DaysArrow down" + CurrentBar, false, 0, High[0], Brushes.Red);
    }

    You would then have to apply this to a Daily chart and it will draw a Red Down Arrow anytime there was 5 previous down bars.

    I have also attached a screen shot how you could build this using the strategy wizard, then click on view code to grab the code and then paste it into an indicator under OnBarUpdate. (See Screen Shot).

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Yhx for the code, played around with it looking good. is it possible to draw that arrown under the candle ?

      And is is also possible to add a price range so a minimal drop of 5$ on those bars?

      Comment


        #4
        Hello Cube1984,

        Yes, you would be able to have the arrow drawn under the bar. To accomplish this, you would change the Y input from a value of High at bars index zero to a value of Low at bars index zero.
        Please see syntax of the draw arrow.



        Yes, it would be possible to require a lower close of at least 5 points by adding +5*TickSize to the more recent bar. For example,

        if ((Close[0] +5*TickSize < Close[1])

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, Yesterday, 01:02 PM
        0 responses
        23 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        16 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        94 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        147 views
        2 likes
        Last Post CaptainJack  
        Working...
        X