Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsAgo of a drawing dot

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

    BarsAgo of a drawing dot

    I am working with the indicator ColoredSMADrawAnswer which draws a green dot when the SMA switches from Falling to Rising and draws a red dot when the SMA switches from Rising to Falling. I am scripting a Strategy that accesses the indicator and I want to the Strategy to only enter on the next bar after the Dot is drawn. How do I reference the drawing object (which is drawn by the indicator) by the strategy and only set it to enter if the Dot was drawn one bar ago?

    #2
    You would be better off trying to get the Rising and Falling pattern instead of the draw object. Do you what exactly the Indicator is checking for on the Rising and Falling?

    NS has methods available for this respectively called Rising() and Falling() which return a bool

    Edit: The reason for this is that you don't get the Draw Object from the indicator. You would use the DrawObjects Collection to see what objects are drawn on the chart and then process it that way. More of a pain instead of using the same pattern as the indicator is using in the first place

    Comment


      #3
      Hello kennyb59,
      Thanks for posting today.

      You may not have to reference the object that you drew. If you know when you drew the object you can track when that object was drawn, track it from the drawing condition.

      Then when the next bar updates if the object was drawn in the last bar then you can have your entry statement.

      If you are using CalculateOnBarClose = true; then you will only need a simple boolean statement to determine when the dot was drawn. After the dot is drawn set it to true. The next bar will update and check if the boolean is true and entry or reset the object is drawn boolean.

      Please let us know if we may be of further assistance for anything NinjaTrader.
      Alex G.NinjaTrader Customer Service

      Comment


        #4
        Thx for your quick reply. The drawn dot is based on the Rising and Falling Conditions and a bool called DotSwitch so if Rising and DotSwitch draw a green dot and if Falling and not DotSwitch draw a red dot. I only want entries 1 bar after the drawn dots.

        Comment


          #5
          Alex Thx for your quick reply. I know when the last object was drawn, but I am unsure what you mean by "you can track when that object was drawn, track it from the drawing condition."

          Comment


            #6
            Hello kennyb59,
            Thanks for the reply.

            To clarify you can track this by placing some object to track the bars within the condition statement of when the drawing object is drawn.

            For example
            Code:
            int barWhenEntered =-1
            ...
            
            if (some condition)
            {
            
            //where DrawDot is called
            DrawDot("tag", true, 0, Low[0],Color.Blue);
            barWhenEntered = CurrentBar
            
            }
            Then you can use the barWhenEntered to determine if you should enter 1 bar away from the drawing object.

            Please let us know if we may be of further assistance for anything NinjaTrader.
            Alex G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            71 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            143 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            76 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            47 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            51 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X