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

How do I access this property in a structure in my code

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

    How do I access this property in a structure in my code

    I am trying to get the color of an Andrews Pitchforks that have been manually drawn on a chart. Using the supported method, has a bug according to Tech support. iAndrewsPitchforks --> Pen -- Color. The problem is it always returns Blue, no matter what color I have for the lines in the popup properties windows. In using VS debugger and watch window, I have found a structure that has the value of the line colors I want, which is the color I see in the chart window. Support states this is unsupported and can not help. I am attaching a screenshot of the VS watch window with an arrow pointing to the property I want. It is showing the color as Dark Violet. I have tried a few things, but I am self taught in C#, and can't get this resolved on my own.

    Can someone show me what the line of code would look like to "get" (read) the Color value. Also, if I need to set up / define it first, please include that.

    Here is my declaration section,
    so I would think I can access the structure from within NinjaTrader.Gui.Chart;

    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using
    using System.Windows.Forms;
    #endregion

    Here is where I read drawn objects

    // loop through all drawn obncts to locate each Andrew Pitchfork that was manually drawn
    foreach (IDrawObject draw in DrawObjects)
    {
    // Determinite if selected object is an Andrews Pitchfoirk
    if (draw.UserDrawn && draw.DrawType == DrawType.AndrewsPitchfork )
    {
    // when found then get amd save to variables bars ago and price values of the 3 points
    // Then I use the 3 points in the calculations and drawing of the DGLs

    pitchfork = (IAndrewsPitchfork) draw ;

    Here is where I try to use the color I get fro iAndrewsPitchfork
    DrawLine("JOR"+JOR_Line_Cnt.ToString(), false, pitchfork.Anchor1BarsAgo, JOR_Anchor_Price1, JOR_Draw_End_Bar, JOR_Tmp_Price, pitchfork.Pen.Color, DashStyle.Solid, 2);



    TIA to those who are willing to help. I'm getting smarter each time I fall in a new hole.

    John
    Attached Files
    Last edited by joromero; 08-05-2014, 11:09 AM.

    #2
    Hi joromero,

    Thanks for your post.

    It is not possible to change the colors of the AndrewsPitchFork object through code.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I am not looking to change the color of the pitchfork, I just want to access the color to use in the lines I draw to match a certain object I find on the screen. So in the code snippets I provided you can see, I read the drawn objects, then I tried to access the pitchfork color using the NT provided call. There is a bug in it, as your peers have already sent to development. I was hoping another developer would be able to provide me some direction on how to read / get / access the color value inthe structure I provided in the VS watch window.

      Thanks for your time to respond.

      John

      Comment


        #4
        Hi joromero,

        The issue on why this will not work, is the individual lines of the pitchfork are not using the overall drawing objects pen color.

        The individual lines from this object cannot be accessed.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,

          Thanks again for the reply. So how do I set the overall pen color? It seems no matter which of the lines I changed, it always stayed Blue as the pen color I was able to read / get

          John

          Comment


            #6
            Hi joromero,

            I am slightly confused by your answer.

            You mention in post 3 "I am not looking to change the color of the pitchfork", then "then I tried to access the pitchfork color using the NT provided call.".

            Does this mean you are trying to set the color of the pitchfork lines or are you trying to change the color of a different type of drawing object like a horizontal line?

            It is not possible to change the colors of the AndrewsPitchFork object through code.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              ChealseaB,

              I not trying to change the color of the pitchfork. I am trying to read the color of the pitchfork and use that color to set the color of a group of lines I am drawing on the chart from within my indicator. The color I want is the color I see on the chart. What the iAndrewsPitchfork returns is always Blue. Which if you go back to my original post in this stream, you will see screen shots and snippets of code, showing
              1 - where I read all of the drawn objects on a chart
              2 - when a pitchfork is found, use its color to set the color of the lines I am drawing from my indicator..

              Patrick in another stream from a month ago, finally stated this has been sent to development,

              John

              Comment


                #8
                Hi joromero,

                The issue is the same.

                You are not accessing the individual lines of this object which have their own colors.

                The Pen.Color of the AndrewsPitchfork does not really mean anything.

                Yes, this issue has been entered into our tracking system.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  ChelseaB,

                  Thanks for your time to reply, but I am still at my original request. I am looking for a reply from an independent developer who can assist me with the "unsupported" way to access the data structure which I describe in my original post in the stream.

                  If there is a developer out there that understands my request and knows how to access the desired data structure, please help.

                  John

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Davidtowleii, Today, 12:15 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Davidtowleii  
                  Started by guillembm, Yesterday, 11:25 AM
                  2 responses
                  9 views
                  0 likes
                  Last Post guillembm  
                  Started by junkone, 04-21-2024, 07:17 AM
                  9 responses
                  68 views
                  0 likes
                  Last Post jeronymite  
                  Started by trilliantrader, 04-18-2024, 08:16 AM
                  4 responses
                  20 views
                  0 likes
                  Last Post trilliantrader  
                  Started by mgco4you, Yesterday, 09:46 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X