• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Update Position of Manual Drawing

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

    Update Position of Manual Drawing

    I've drawn a textbox manually and I would like to update it's position via my strategy. Basically I want to be able to edit the text on the chart so I can pass commands to the strategy and have the position always be in the lower left hand corner.

    Should this be possible? How do I update the position? Here's what I'm trying so far:

    foreach (DrawingTool draw in DrawObjects.ToList())
    {
    if(draw is DrawingTools.TextFixed)
    {
    TextFixed textFixed = draw as TextFixed;
    if(textFixed.Tag == "Command")
    {
    textFixed.Anchor.StartAnchor.Price = MIN(ChartBars.ToIndex - ChartBars.FromIndex)[0] - 1;
    }
    }
    }

    #2
    Hello calebsandfort,

    Draw.TextFixed objects are fixed. They don't use a price or time value they use TextPosition.BottomLeft, BottomRight, Center, TopLeft, TopRight.
    https://ninjatrader.com/support/help.../textfixed.htm

    You may be thinking of Draw.Text.
    https://ninjatrader.com/support/help...en-us/text.htm


    It is not currently possible to modify a drawing object's anchors BarsAgo or remove drawing objects that are not created by the script. It is possible to change the colors of drawing objects and sometimes other properties. However, I am unsure about specifically changing the price of Text objects anchor.

    I will further research and if I find this is not possible I will submit a feature request on your behalf for the development team to consider this for a future version of NinjaTrader.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes, Draw.Text is what I meant.

      Basically I'm just trying to figure out a way to communicate with my strategy while it is running. My first thought was a text field that I could pass commands thru.

      I also saw someone suggest using a text file in the NinjaTrader temp directory.

      Any other ways of doing this?

      Comment


        #4
        Hello calebsandfort,

        I am finding that the price can be changed when the script is in real-time data.

        Below is a link to a video and attached is the test script.
        https://drive.google.com/file/d/1nXS...w?usp=drivesdk

        Just a heads up, the DrawObjects collection may not be populated when the chart is processing historical data.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ralett, Today, 11:44 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Spencer  
        Started by DMDINAZ, Today, 11:03 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by sukhob, Today, 10:14 AM
        4 responses
        10 views
        0 likes
        Last Post sukhob
        by sukhob
         
        Started by beaacontreras, Today, 09:27 AM
        1 response
        20 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by fxSol, 03-17-2019, 04:17 AM
        5 responses
        28 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Working...
        X