Click here to Login





                                                   Line drawing within a function

  0

0
David
2022-07-05 00:44:22


Hi

I'm slowing writing a function that will give me what I currently think will be useful metrics when simulations are run.

The actual function most likely won't have a visual output, but for testing I am creating a visual output as it shows if my code is correct.

So say I'm looking at adding lines to the highs and lows of "close" data for the last 40 bars, I can create this in a array, I can then work out the line formula between each HL point,
but outputting this line/lines visually is the fun part.

The only way I think this can be done is by creating a copy of the array you are examining, and where the newly calculated lines start and stop patch the array with the new line data formula.
Plotting this newly created array outside the function will then show / overlap the current data with the line modifications in the correct place.

Is there a line drawing function accessible to functions that may make this easier?

Is there another/better way this can be done?

Thanks



QuantShare
2022-07-05 11:31:17

  0

Best Answer
No, unfortunately there is no way to do that directly as QS language is a vector based language and calculation must be performed for each bar.
You can only plot variables (not particular lines).

To create custom lines, you must use the drawing tool scripting language but you won't be able to use that in simulations.



No more messages
0




Reply:

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"










QuantShare

Trading Items
Volume Accumulation Trend Line
TFS Tether Line
Advanced Quotes and Custom Databases Function
Least Squares Regression Line
Stock Bounces off its Previous Resistance or Support Line

How-to Lessons
How to draw an horizontal segment line using QS language
How to use the Fibonacci retracement drawing tool
How to copy and paste drawing tools
How to use a custom drawing tool
How to plot a time-series that do not update the chart scale

Related Forum Threads
Simple Question - drawing a line
Passing date variable from custom drawing tools to custom functio...
Problem drawing trend line using version 2.91
Percent Rank Function Needed
DRAWING TOOLS

Blog Posts
How to Reference Drawing Studies in QS Formulas
Custom Indicator: Accumulation Distribution Line
How to combine long, short and custom portfolio strategies within...
The 'inside period' function
How to create market indicators using the composite function - Pa...









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
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.