Click here to Login

                                                   Passing date variable from custom drawing tools to custom function


2021-08-01 16:49:59

Is it possible to pass a string variable, date, of the bar clicked with custom drawing tool to a custom function. The custom function will take the date input from the mouse position clicked with custom drawing tool , and will do some calculation. I have been able to do it the otherway around where custom function will create a global variable and custom drawing tool will get the variable. But haven't be successful the other way around. Thank you

2021-08-13 09:31:28


You can try to use this function after a click on the chart.

You can detect the number of clicks using
int clicks = Functions.ClickPositions.Length;

And after the click (if clicks>0), use

To stop drawing, otherwise the drawing tool will update the formula each time the mouse cursor moves on the chart and this will slow down or make the application irresponsive.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Advanced Quotes and Custom Databases Function
Lagged Data From a Custom Database
Sum of a Custom Database's Field
Custom High/Low Range
Upside-Downside and Custom Standard Deviation

How-to Lessons
How to use a custom drawing tool
How to create a custom trendline
How to add custom position-based metrics to your trading system
How to create a custom trading indicator
How to copy and paste drawing tools

Related Forum Threads
Custom Drawing Tools
Using ".SymbolInfo" in Custom Drawing Tools ?
Problem with performance calculation in custom function
Custom Date Format When Importing Data from CSV
Plotting the data from custom -Intraday data base

Blog Posts
Create custom metrics for the statistical data analysis tool
Speed Up Optimizations by Saving Ranking Data into a Custom Datab...
Custom Indicator: Accumulation Distribution Line
Custom Indicator: Relative Strength
The custom trading indicators tool explained

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2023
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.