Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FIB drawing tool displaying ticks not price

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

    FIB drawing tool displaying ticks not price

    Some one very kindly helped me add a further couple of FIB tools to the drawing tools part so that it was possible to hotkey without using a template.

    I now have multiple fibs all hot keyed so I don't have to go into it and change the template which I find very useful.

    At the moment the default fib tool shows the price against each of the levels.

    Is it possible to change this so it shows the ticks instead between each level?

    Below is a section of the code if it is possible could you please show me how to do this and I can change the rest to match this one.

    namespace NinjaTrader.NinjaScript.DrawingTools
    {

    public class BreadFibRetA : FibonacciRetracements
    {

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    AnchorLineStroke = new Stroke(Brushes.DarkGray, DashStyleHelper.Solid, 1f, 50);
    Name = Custom.Resource.NinjaScriptDrawingToolFibonacciRet racements;
    Name = "Bread Fib Ret A";
    PriceLevelOpacity = 5;
    StartAnchor = new ChartAnchor { IsEditing = true, DrawingTool = this };
    EndAnchor = new ChartAnchor { IsEditing = true, DrawingTool = this };
    StartAnchor.DisplayName = Custom.Resource.NinjaScriptDrawingToolAnchorStart;
    EndAnchor.DisplayName = Custom.Resource.NinjaScriptDrawingToolAnchorEnd;
    }
    else if (State == State.Configure)
    {
    if (PriceLevels.Count == 0)
    {
    PriceLevels.Add(new PriceLevel(0, Brushes.DarkGray));
    PriceLevels.Add(new PriceLevel(20, Brushes.DodgerBlue));
    PriceLevels.Add(new PriceLevel(40, Brushes.CornflowerBlue));
    PriceLevels.Add(new PriceLevel(60, Brushes.SteelBlue));
    PriceLevels.Add(new PriceLevel(80, Brushes.DarkCyan));
    PriceLevels.Add(new PriceLevel(100, Brushes.DarkGray));
    }
    }
    else if (State == State.Terminated)
    Dispose();
    }
    }​


    Thanks in advance bread.

    #2
    Hello Mr Bread,

    Thank you for your post.

    Yes, it is possible. You would need to create your own custom logic for converting the prices into ticks. This can be done by dividing the price by the TickSize and using Math.Abs() to make sure there is a positive number.

    TickSize - https://ninjatrader.com/support/help...8/ticksize.htm

    Below is a link to a forum post demonstrating converting price to ticks:



    Please let me know if we can assist further. ​

    Comment


      #3
      Originally posted by NinjaTrader_Gaby View Post
      Hello Mr Bread,

      Thank you for your post.

      Yes, it is possible. You would need to create your own custom logic for converting the prices into ticks. This can be done by dividing the price by the TickSize and using Math.Abs() to make sure there is a positive number.

      TickSize - https://ninjatrader.com/support/help...8/ticksize.htm

      Below is a link to a forum post demonstrating converting price to ticks:



      Please let me know if we can assist further. ​
      Gabby thanks for your reply;

      it is beyond me with regards how to exactly do this is there any way you can show me the code and where to attach it to in this and I can copy and modify to suit the rest i am sure.

      Thanks Bread

      Comment


        #4
        Hello Mr Bread,

        Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Showing you the code / coming up with the logic for you would be considering creating code.

        The link I provided has code demonstrating how you can convert the price to ticks in code, which you can use in your own script.

        If you are interested, you can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        75 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        45 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        26 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        32 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        62 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X