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

Parsing Geometry Source Data

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

    Parsing Geometry Source Data

    Dear NinjaTrader_Jesse ,

    I came across the Indicator ChartToolBarCustomMenuExample in search of a way to create a geometric toolbar Icon for things like components of Elliott Wave such as ABCD, 12345, etc. I noticed the following code on line 100 of this indicator that you helped with parsing the source data for the geometric icon.

    Code:
    // thanks to Jesse for these figures to use for the icon
    System.Windows.Media.Geometry topMenuItem1Icon = System.Windows.Media.Geometry.Parse("m 70.5 173.91921 c -4.306263 -1.68968 -4.466646 -2.46776 -4.466646 -21.66921 0 -23.88964 -1.364418 -22.5 22.091646 -22.5 23.43572 0 22.08568 -1.36412 22.10832 22.33888 0.0184 19.29356 -0.19638 20.3043 -4.64473 21.85501 -2.91036 1.01455 -32.493061 0.99375 -35.08859 -0.0247 z M 21 152.25 l 0 -7.5 20.25 0 20.25 0 0 7.5 0 7.5 -20.25 0 -20.25 0 0 -7.5 z m 93.75 0 0 -7.5 42.75 0 42.75 0 0 7.5 0 7.5 -42.75 0 -42.75 0 0 -7.5 z m 15.75 -38.33079 c -4.30626 -1.68968 -4.46665 -2.46775 -4.46665 -21.66921 0 -23.889638 -1.36441 -22.5 22.09165 -22.5 23.43572 0 22.08568 -1.364116 22.10832 22.338885 0.0185 19.293555 -0.19638 20.304295 -4.64473 21.855005 -2.91036 1.01455 -32.49306 0.99375 -35.08859 -0.0247 z M 21 92.25 l 0 -7.5 50.25 0 50.25 0 0 7.5 0 7.5 -50.25 0 -50.25 0 0 -7.5 z m 153.75 0 0 -7.5 12.75 0 12.75 0 0 7.5 0 7.5 -12.75 0 -12.75 0 0 -7.5 z M 55.5 53.919211 C 51.193737 52.229528 51.033354 51.451456 51.033354 32.25 51.033354 8.3603617 49.668936 9.75 73.125 9.75 96.560723 9.75 95.210685 8.3858835 95.23332 32.088887 95.25177 51.382441 95.03694 52.393181 90.588593 53.943883 87.678232 54.95844 58.095529 54.93764 55.5 53.919211 Z M 21 32.25 l 0 -7.5 12.75 0 12.75 0 0 7.5 0 7.5 -12.75 0 -12.75 0 0 -7.5 z m 78.75 0 0 -7.5 50.25 0 50.25 0 0 7.5 0 7.5 -50.25 0 -50.25 0 0 -7.5 z");
    I find this method an easy way to create a 4-point ABCD path Icon and perhaps is mush less data for a Path. However, my research has not helped much for C# documentation of how to create the Path source data ( parse the 4 pairs of X,Y data) for the an ABCD.

    Would you kindly point me to a reference for creating parse data source for a Geometry Path Icon, i.e. ABCD, 12345, etc. Or, perhaps provide a modification of the above code for an ABCD or 12345 Path that I could use as an example.

    Many Thanks.
    Attached Files

    #2
    Hello aligator,

    Thank you for the post.

    I find this method an easy way to create a 4-point ABCD path Icon and perhaps is mush less data for a Path. However, my research has not helped much for C# documentation of how to create the Path source data ( parse the 4 pairs of X,Y data) for the an ABCD. Would you kindly point me to a reference for creating parse data source for a Geometry Path Icon, i.e. ABCD, 12345, etc.
    Are you asking how to use the letters abcd or 12345 as the icon?

    For letters and numbers you could just enter those as strings rather than using a path.

    Icon = "A", //topMenuItem1Icon,
    Icon = "1", //topMenuItem1Icon,

    There is limited space so items like 12345 wont work as an icon. That would be better suited as the items text instead.
    Header = "12345",

    If you want to create your own paths you can use external tools to do that. The general way would be to get an SVG path and then export it from inkscape. You can google inkscape to find a download for that. You can take a very simple single color SVG image and open it with inkscape then go to file -> save as. In the dialog select Microsoft Xaml from the dropdown. That will generate paths and geometry which can be used in WPF/xaml. The icon would need to be a square image/path/text.

    I look forward to being of further assistance.


    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello aligator,

      Thank you for the post.


      Are you asking how to use the letters abcd or 12345 as the icon?
      Thank you NinjaTrader_Jesse,

      No I do not want to use letters. I intend to simply modify the above indicator using StreamGeometry to create an Icon showing a ZigZag line similar to 123 or 12345 Elliott Wave ZigZag lines. Here is what I attempt to do for a 5-leged ZigZag line, although the data may not be quite correct:

      Code:
                  System.Windows.Media.Geometry topMenuItem1Icon = System.Windows.Media.Geometry.Parse("L 10,10 30,40 30,40 40,20 40,20 60,60 60,60 70,40 70,40 90,70 Z");
      Thanks.

      Comment


        #4
        Hello aligator,

        Thank you for clarifying.

        I am not sure what those icons look like but if you can draw them in inkscape using svg paths you could save them as xaml paths. That is likely the easiest way. You would otherwise need to go learn the syntax for making paths and then type out the geometry code.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by George21, Today, 10:07 AM
        0 responses
        2 views
        0 likes
        Last Post George21  
        Started by Stanfillirenfro, Today, 07:23 AM
        8 responses
        23 views
        0 likes
        Last Post Stanfillirenfro  
        Started by DayTradingDEMON, Today, 09:28 AM
        2 responses
        16 views
        0 likes
        Last Post DayTradingDEMON  
        Started by navyguy06, Today, 09:28 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        8 responses
        32 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X