Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Edition of a custom drawing tool

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

    Edition of a custom drawing tool

    Hi,

    I have a custom drawing tool called Measure. The tool provides measurement not only in points but also displays mesurement in USD.

    Questions:
    1. I'd like to be able to input max risk amount in usd e.g. $600 usd.
    2. I'd like the tool to divide max risk amount in usd / displayed measurement in usd so I would know how many contracts would I need to take
    3. If possible I would like to have number of contracts rounded.

    Could you possibly tell me what should I edit to get these features?

    Thank you
    Attached Files

    #2
    Hello Ludwik,

    To make a input you would need to make a public property. Once a public property is made that will show up in the user interface and will be accessible in code using the name of the public property.

    To do math and rounding you can use the standard C# math features, Math.Round is used in C# for rounding.

    Rounds a value to the nearest integer or to the specified number of fractional digits.


    Comment


      #3
      Thank you Jesse,
      Would you mind highlighting areas which I need to edit in order to have it working?
      Thank you

      Comment


        #4
        Hello Ludwik,

        Which part are you asking for help with here? A public property needs to be defined in the class, you can take a look at the built in drawing tools code for examples of how to structure your script. The rounding part would need to be done where you are calculating the value that you eventually render.

        Comment


          #5
          I'm not too bothered with the rounding, I can do that later sometime.
          Most important parts are:
          1. Being able to input max risk
          2. Being able to do a calculation and have it displayed in the measurement box on chart. Where current value per point in USD is displayed.

          Comment


            #6
            Hello Ludwik,

            Being able to input a value requires making a public property. This is the same concept from indicators and strategies. For example:

            public double MyUserInput {get;set;}

            Being able to calculate a value and display it in the chart would require that you utilize your input, in the example that is MyUserInput, and then do the math you wanted before rendering the value in OnRender. Any conversions you need like converting to USD would require that you do the math to reach that value, the platform does not have any functions to convert values for you.

            Comment


              #7
              Thank you Jesse.

              What I meant in previous message was asking about exact location in the file where I should have it.

              Could you please point out which lines are these for both calculaction and input?

              Comment


                #8
                Hello Ludwik,

                While I don't know what exact line of code you may need to edit those would be the general steps, you would have to go through your code and program what you want in the locations you wanted. When developing custom scripts that is the main process that you would need to follow. If the script you attached is not something you developed yourself you will likely need to contact the original developer for further assistance.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                648 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                574 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X