Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to modify Gann Fan drawing tool

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

    how to modify Gann Fan drawing tool

    Hi
    I wanted to modify the Gann Fan drawing tool so as to:
    (1) select number of fan lines displayed say 1 - 8,
    (2) pass a variable scale factor eg 3.5 x 2.1 for each of the lines specifying line number - e.g. line 2 scale 3.5 x 2.1
    (3) selecting which lines are visible and line color e.g. line 1 visible color red; line 4 not visible, color - ; .
    (4) I would like to select any two bars on the chart and based on some calculations determine which lines are visible and what scale factor to use...

    can you please tell me how to go about this.
    thanks
    Suraj

    #2
    Hello Suraj,

    Note, working with drawing tool scripts is advanced and will require c# coding skills.

    The GannFan drawing tool is open source, and you are welcome to make a copy of this and modify the copy.

    New -> NinjaScript Editor -> DrawingTools -> GannFann

    Right-click within the code and select Save As, then provide a new unique name for your custom tool.

    The custom logic you will need design.

    The number of angles (lines) is provided as a collection, which allows the user to set any number of angles they would like.

    The logic for your custom calculations can likely be modified in the OnRender() and CalculateExtendedDataPoint methods.

    The Brush rendered for the line is defined on line 378 which defaults to the color the user has chosen.


    "I would like to select any two bars on the chart and based on some calculations determine which lines are visible and what scale factor to use..."

    This would be very advanced and would start to wander into unsupported territory for a drawing object. A drawing object is only meant to set selection point anchors.

    Unfortunately, I would not have guidance I can provide you in this direction. However, you might be able to add additional selection points for this purpose.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thanks for the pointers. I have two follow on questions:

      When I save a copy of Gann Fan to modify - are there any Method names or parameter names that I have to rename so as not to interfere with the original Gann Fan drawing tool?

      If I make two anchor points how do I get the bar number and price data so as to be able to use it in calculations and how would I make that data available to the OnRender() and the CalculateExtendedDataPoint methods to be able to do the calculations?

      I will work on the pointers you have given and come back with any questions after that.

      Thanks,
      suraj

      PS: When I have follow on questions - should I post them in this topic or start a new topic ( there will be a gap of some time it would take me to try out changes)? TIA.
      Last edited by suraj; 10-16-2023, 05:10 PM.

      Comment


        #4
        Hello suraj,

        The Class names and Enums will need to have unique names.

        An Anchor has a .SlotIndex and .Price property with the time and bar number.
        https://ninjatrader.com/support/help...rawingtool.htm

        See line 379 where a line is rendered using the information from anchor points.


        Inquiries that are the same topic should go in the same thread. Inquiries that are a different topic should go in a new thread.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        606 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        353 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        560 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        561 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X