Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.


    You may be thinking of Draw.Text.



    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.

        An <Anchor>.Time can also be modified.

        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
        Last edited by NinjaTrader_ChelseaB; 05-19-2021, 02:27 PM.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by hazylizard, Today, 08:38 AM
        2 responses
        8 views
        0 likes
        Last Post hazylizard  
        Started by geddyisodin, Today, 05:20 AM
        2 responses
        17 views
        0 likes
        Last Post geddyisodin  
        Started by Max238, Today, 01:28 AM
        5 responses
        47 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by giulyko00, Yesterday, 12:03 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by habeebft, Today, 07:27 AM
        1 response
        16 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Working...
        X