Changing or Deleting a "DrawLine" or "AnnotateBar"
Author: M311as555
Creation Date: 11/21/2015 4:46 PM
profile picture

M311as555

#1
I've searched WLP Wiki, and could not find anything related to changing or deleting a "DrawLine" or "AnnotateBar" that was previously drawn.

Both "DrawLine" or "AnnotateBar" return "void" so I can't even reference them.

I would like to draw a line form point A to point B.
Then at point C, I would like to "Re-Draw" the line from point A to point C.

I would also like to change the text in the "AnnotateBar" for points B and C if needed.

Also, Is there a page or doc that explains all of WLP's capabilities?

Thank you in advance.
profile picture

Eugene

#2
QUOTE:
I've searched WLP Wiki, and could not find anything related to changing or deleting a "DrawLine" or "AnnotateBar" that was previously drawn

That's because the task you're up to sounds unusual. You do not want to delete a line or annotation which is driven by a condition in the code. If it's invalid, the line is simply not being drawn.

QUOTE:
Also, Is there a page or doc that explains all of WLP's capabilities?

Wealth-Lab 6 Features
profile picture

M311as555

#3
Eugene,

Thank you for responding to my question so quickly.

Part of my code is to draw something similar to a "Trend Line", bar by bar.
Ideally, I would like to draw a line from price 1 - bar 1, to price 2 - bar 2. Then after evaluating conditions at price 3 - bar 3, either "extend the existing line" or "delete the existing and draw a new line" from price 1 - bar 1 to price 3 - bar 3, repeating this process up to price n - bar n.
The line would continue, say UP, until conditions are right, then start a new line Down.

Right now, I have to wait to make absolutely sure that the "all conditions are correct" before even drawing the Up line. Then start evaluating each bar to make absolutely sure that the "all conditions are correct" before even drawing the Down line.

This is more of a Visual indication for me. The values of variables for current and past bars change automatically, so the code doesn't really care.

Likewise, for the "AnnotateBar". My Strategy has over 2,000 lines and is only about 25% complete. I assign labels to the bars where the trend line changes direction (based on past, current (I'm assigning bar - 6 as the current bar) and future bars. Another portion of the code makes "higher level" decisions based on the labels. Sometimes it's necessary to change past labels, that drives the code that makes the "higher level" decisions.

Again, this is more of a Visual aid for me, to evaluate if the strategy is working correctly.

The programming language for TradeStation has a function for this task. It goes something like this:
TL_Ref = Trendline(price 1, bar 1, price 2, bar 2, color, etc.) // This is very similar to WLP, except that it passes back a Reference for that particular trendline.
RedrawTrendline(TL_Ref, price 1, bar 1, price n, bar n, color, etc.) // This function targets the particular line referenced by "TL_Ref", and allows the line to be redrawn.

I used a portion of this code as an Indicator in TradeStation. Now, in WLP, I'm trying to make it a full-blown trading program, with an Indicator overlay, that tells me what it is doing, and what it expects to happen next.

I'm relatively new to WLP (only about 3 months) so I don't have a very good handle on everything it is capable of.

Any and all help you can provide would be greatly appreciated.

Thank you again.

profile picture

Eugene

#4
Christopher,

On the surface it sounds like your program might benefit from usage of this design pattern: Setups, Triggers, Delays, and Timeouts. In fact, we've used it many times for similar tasks (chart pattern detection) which implies drawing of complex figures. See the "Chart patterns" folder in WLP's "Open strategy" dialog, making sure you've downloaded all publicly available strategies.
profile picture

Cone

#5
1. Don't draw any lines until you've evaluated all the bars.
2. While you're processing the bars, save what you need to draw (at a later time) in an object
3. Save multiple objects in a list.
4. At the end of the script, process the list and do the drawing.

There are several [somewhat complex] examples of this in a series of trendline strategies that you can download from the Strategy Explorer > Download... feature. After you complete the download, look for:

Active Trader 2013-04 | Trendline Breakouts
Active Trader 2013-05 | Trendline Breakouts v2
Active Trader 2013-06 | Trendline Bounces
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).