Administration
Joined: 9/18/2004 Posts: 3,522
|
The label property was added to RealCode conditions in build 11. This property will allow you to programatically add text to your indicator when it is painted by your condition. The label property supports a look-back (bars ago) parameter to set the label on a previous bar.
This property should help you identify legs in a complex setup. Below is a condition for Trend Reversal Sell condition that shows a label when the condition passes, and a label on the first bar of the setup. Paint an indicator by this condition to see the labels appear. (Note this condition is not common and a scan may not produce any passing symbols.)
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Trend Reversal Sell
'|******************************************************************
If price.close < price.close(1) AndAlso price.close(1) < price.close(2) AndAlso price.close(2) > price.close(3) Then
If price.Low < price.low(1) AndAlso price.low(1) < price.low(2) AndAlso price.low(2) >= price.high(3) Then
If price.High / price.High(1) >= 1.01 Then
label = "TRS"
label(3) = "Setup"
pass
End If
End If
End If
Attachments: Untitled picture.png - 71 KB, downloaded 1,319 time(s).
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
Also, the bars ago parameter is supported in RealCode indicators.
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 10/7/2004 Posts: 1,006
|
Thanks Kuf, thats very cool!
Winnie
|
|
Platinum Customer
Joined: 10/7/2004 Posts: 357
|
Cool, this will be very handy!
can we control the position of the label?
above
left center right
below
and control the color/font of the text? or does it just default to the paint color?
|
|
Registered User Joined: 10/7/2004 Posts: 1,006
|
For now, lets KISS
|
|
Registered User Joined: 10/7/2004 Posts: 1,006
|
Question; For a RealCode long strategy label, example the Setup and Buy Trigger labels, these are two labels; can we also have a third Sell or Exit label in the same RealCode Condition which will be in the future (look-forward) or do we need a new RealCode Condition Sell or Exit label once that condition is met?
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
Look forward labels will not work. But with some intelligence, you can store that you want to write a label in the future in your RealCode so when you reach that index you apply the label.
Runningdawg, you can control the label position on the indicator that the labels are applied to. Click the indicator to open the edit window to change the label position.
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 10/7/2004 Posts: 364
|
Ken , this sounds great. My question is can I test the value of the label in a condition (rule)?
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
Test it in a different condition?
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 10/7/2004 Posts: 364
|
I don't understand your question to my question. Guess I was assuming to much.
I am plotting and indicator, such as a swing point, and I calculate the percentage of swing of a low pivot to a high pivot. This percentage I want put out in a label. Then create a condition to test the label value for minimum value. Can I do that.
kermitp
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
Kuf,
I noticed that my labels on my indicator are completely off now. it was working before. see post :
http://forums.worden.com/Default.aspx?g=posts&t=46332
|
|
Registered User Joined: 2/2/2005 Posts: 129
|
Posted in BUGs section, but had a realcode "label=" working prior to latest release, that uses the toString method.
Now it doesn't display. Nothing. Nada.
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
pthegreat this has been fixed for the next build.
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
Kuf, It's working again with the new updated version. Thx!!
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
Now the label property doesn't work anymore.
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
pthegreat, can you explain?
I ran this code from your other post and the labels appear just fine:
Static TDcount As Integer
' first check if we start at the 5th bar
If isFirstBar Then
plot = Single.NaN
TDcount = 0
End If
' we're on the 5th bar, or higher
If currentIndex >= 5 Then
Select Case tdcount
'this is the Bearish TD price flip, which if true, puts us on the first bar of the TD-Buy setup
Case 0
If Price.Close < price.Close(4) AndAlso _
Price.Close(1) > price.Close(5) Then
TDcount += 1
label = tdcount
plot = tdcount
End If
Case Else
If Price.Close < price.Close(4) Then
TDcount += 1
label = tdcount
plot = tdcount
Else
tdcount = 0
End If
End Select
Else
setindexinvalid
End If
If tdCount = 9 Then
tdCount = 0
End If
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
sorry, my mistake, i was referring to your code. first post in this thread. it is working.
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
I'm using the label property for conditions.
for example I have a variable which I print on the pirice pane like this :
dim stoploss as single
calc....
calc...
label = stoploss
could I pre-empt it with a text ? so it would print :
let's say stoploss = 6.50
stop = 6.50
I tried label = "stop=" stoploss
but didn't work.
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
or could I change my stoploss variable from single to string, and then do soemthing like :
dim stoptxt as string
dim stoploss as single
.
.
stoptxt = "stop =" & stoploss
label = stoptxt
didnt work either.
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
well wadda ya know, it is working, cool!
stoptxt = "stop=" & stoploss
label(I) = stoptxt
guess I forgot the spaces between the "&"
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
yes, the & symbol is the concatination character for strings in vb.net. Glad you figured it out.
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
sometimes it works, sometimes it doesn't.
see pic, label appears on the pass on 4/8/10, but not on 4/19 and 4/27.
here's the code :
'# TDbuy = chart.TDseqBuy.3
Static barlow As Single
Static bar8low As Single
Static bar9low As Single
Dim stoploss As Single
Static bar9pos As Integer
Dim low As Single
Dim stoptxt As String
If isfirstbar Then
barlow = -1
bar8low = 0
bar9low = 0
End If
If TDbuy.value = -9 Then
barlow = price.minlow(2, 2)
bar8low = price.low(1)
bar9low = price.low
bar9pos = currentindex
low = price.MinLow(5)
For I As Integer = 1 To 5
If price.Low(I) = low Then
stoploss = price.Low(I) - (price.High(I) - price.Low(I))
stoptxt = "stop=" & stoploss
label(I) = stoptxt
End If
Next I
End If
If bar8low <= barlow Or bar9low <= barlow Or price.low <= barlow Then
pass
barlow = -1
bar8low = 0
bar9low = 0
End If
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
nevermind, I got it.
For I As Integer = 0 To 4 did it.
sorry, should think a little more, before I post.
|
|
Registered User Joined: 10/7/2004 Posts: 364
|
I have code which on the last bar labels the pivot points for a potential double bottom condition. The label while they are correct they do not always show in the best place on the chart.
Using yesterdays (non-streaming) data as of 8-09-10
SWX is an example of one that has the label positioned okay.
While SXI & RRR are example of where the label are not placed in the best position for viewing.
I think if you had the ability to specify in the realcode the "offset direction" with the same values as one has on the indicator edit window that will allow the realcode programmer to specify the location of the label.
Any chance you might enhance the label to allow us to define in realcode the offset?
as mentioned above, I have a realcode indicator that labels each pivot point. I want the low pivot label to go below, or lower left or lower right . While on the high pivot I want the label to go above, or upper left or upper right.
As it is right now the labels plots are sometimes not even close to the price bar. I'll send the layout and you can see what I mean about the label positioning.
Today I have this code which is executed on last bar:
labelbar = currentindex - p2bar
label(labelbar) = "P2 =" & p2 & " " & pm12 & "%"
labelbar = currentindex - p3bar
label(labelbar) = "P3 =" & p3 & " " & pm23 & "%"
I was hoping for something like this:
for high pivot points
labelbar = currentindex - p2bar
label(labelbar,upper left) = "P2 =" & p2 & " " & pm12 & "%"
and for low pivot points
labelbar = currentindex - p3bar
label(labelbar,lower left) = "P3 =" & p3 & " " & pm23 & "%"
|
|
Registered User Joined: 10/7/2004 Posts: 364
|
I sent the layout to support. I am hoping they will consider making an improvement to the label positioning.
As it is now some positions are not where the realcode programmer would prefer them.
|
|
Registered User Joined: 10/7/2004 Posts: 364
|
QUOTE (Kermitp)
I was hoping for something like this:
for high pivot points
labelbar = currentindex - p2bar
label(labelbar,upper left) = "P2 =" & p2 & " " & pm12 & "%"
and for low pivot points
labelbar = currentindex - p3bar
label(labelbar,lower left) = "P3 =" & p3 & " " & pm23 & "%"
After giving this more thought I'd like to revise the request to include specifying a price level for the label.
The realcode programmer knows the price levels of the chart, it isn't hard to determine. So why not allow the person creating the realcode specify at what price level they want label.
labelbar = currentindex - p2bar
label(labelbar,price,upper left) = "P2 =" & p2 & " " & pm12 & "%"
I'd appreciate at least an acknowledgement that Worden Brothers has read the request and provided a response. Like never gone to happen or great idea we'll put it in the plan. In another posting someone mention that lack of response by Worden's. I know everyone is busy but "Customer perception" should always be a major concern to the vendor.
As I mention in my original posting I sent a layout and example of poorly placed labels to support. As yet I have not received any acknowledgement that they got the email. Unfortunately, that has been the norm rather than the exception.
That having been said I think response by those monitoring this forum is usually fantastic on most issues.
Keep up the good work and improve the not so good,
Kermitp
|
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
QUOTE (Kermitp) QUOTE (Kermitp)
I was hoping for something like this:
for high pivot points
labelbar = currentindex - p2bar
label(labelbar,upper left) = "P2 =" & p2 & " " & pm12 & "%"
and for low pivot points
labelbar = currentindex - p3bar
label(labelbar,lower left) = "P3 =" & p3 & " " & pm23 & "%"
After giving this more thought I'd like to revise the request to include specifying a price level for the label.
The realcode programmer knows the price levels of the chart, it isn't hard to determine. So why not allow the person creating the realcode specify at what price level they want label.
labelbar = currentindex - p2bar
label(labelbar,price,upper left) = "P2 =" & p2 & " " & pm12 & "%"
I'd appreciate at least an acknowledgement that Worden Brothers has read the request and provided a response. Like never going to happen or great idea we'll put it in the plan. In another posting someone mention that lack of response by Worden's. I know everyone is busy but "Customer perception" should always be a major concern to the vendor.
As I mention in my original posting I sent a layout and example of poorly placed labels to support. As yet I have not received any acknowledgement that they got the email. Unfortunately, that has been the norm rather than the exception.
That having been said I think response by those monitoring this forum is usually fantastic on most issues.
Keep up the good work and improve the not so good,
Kermitp
Kermitp you been around long enough to know that such a response by anyone at Worden is unlikely. Product enhancements are announced by the release of the feature, period.
|
|
Registered User Joined: 10/7/2004 Posts: 364
|
There is always room for improvement.
I do believe they do listen but are just doing to much to take time to respond.
One can only hope,
Kermitp
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
Great idea Jas. I was about to post a similar request. naturally you would like your labels for bearish triggers below the bar, and for bullish triggers above the bar.
I also would prefer to have the choice to print labels and "true markers" on the indicator itself.
for example:
green up arrow calculates a stoploss, would prefer to have that label printed below the arrow.
purple arrow is a CCI short-term snapdown signal. would like to have that arrow printed on the pane with the CCI indicators, as indicated by the red arrow.
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
sorry, for bearish above the bar, bullish below the bar.
|
|
Registered User Joined: 10/7/2004 Posts: 364
|
Good news, I did get a resposne from Worden Brothers that they will consider improving the label positioning capabilities. So we just have to wait for it to show up someday
Thanks, guys for listening.
Kermit
|
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
QUOTE (Kermitp) Good news, I did get a resposne from Worden Brothers that they will consider improving the label positioning capabilities. So we just have to wait for it to show up someday
Thanks, guys for listening.
Kermit
labelbar = currentindex - p2bar
label(labelbar,price,upper left) = "P2 =" & p2 & " " & pm12 & "%"
Your suggestion of position releative to Price might be even better if it was to position releative to a user specified indictor, not just price.
Maybe a declaration
'# MA2 = indicator.movongaverage
'# labelRelativeTo = MA2
supporting relative and non-relative label statement with mutiple methods
LabelRel(labelbar,upper_left) = "P2 =" & p2 & " " & pm12 & "%"
LabelRel(labelbar) = "P2 =" & p2 & " " & pm12 & "%"
LabelRel(upper_left) = "P2 =" & p2 & " " & pm12 & "%"
LabelRel = "P2 =" & p2 & " " & pm12 & "%"
Label(labelbar,upper_left) = "P2 =" & p2 & " " & pm12 & "%"
Label(labelbar) = "P2 =" & p2 & " " & pm12 & "%"
Label(upper_left) = "P2 =" & p2 & " " & pm12 & "%"
Label = "P2 =" & p2 & " " & pm12 & "%"
|
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
One other aspect to consider is having StockFinder automatically adjust the scale range so that positioned labels at the edges get completely displayed.
The top/bottom edge may need more room if the label positioning is above/below the plot.
The first/last bar may need more area is the label is positioned before/after the bar or in the case of last bar if the label length exceeeds the plot area.
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
my "green and red" colored price candles are starting to look like a christmas tree. I have a handfull of conditions plotting labels on my charts. I'd prefer to keep my candles just red and green. I dont want them to paint in the color of my condition.
request :
Don't make it mandatory having to "add to paintscheme" in order to get the labels on the charts:
I'd prefer to keep candles red and green, as per selected paintscheme,
draw true markers and their labels as per color of the condition.
|
|
Registered User Joined: 7/23/2010 Posts: 84
|
QUOTE (Kuf) The label property was added to RealCode conditions in build 11. This property will allow you to programatically add text to your indicator when it is painted by your condition. The label property supports a look-back (bars ago) parameter to set the label on a previous bar.
This property should help you identify legs in a complex setup. Below is a condition for Trend Reversal Sell condition that shows a label when the condition passes, and a label on the first bar of the setup. Paint an indicator by this condition to see the labels appear. (Note this condition is not common and a scan may not produce any passing symbols.)
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Trend Reversal Sell
'|******************************************************************
If price.close < price.close(1) AndAlso price.close(1) < price.close(2) AndAlso price.close(2) > price.close(3) Then
If price.Low < price.low(1) AndAlso price.low(1) < price.low(2) AndAlso price.low(2) >= price.high(3) Then
If price.High / price.High(1) >= 1.01 Then
label = "TRS"
label(3) = "Setup"
pass
End If
End If
End If
Kuf I just came across, and installed your TRS. Pretty neat and worked great first time out. Didnt understand most of the following discussions you guys had but it's fun trying :-). How about a TRBuy indicator to keep your TRS company on my chart sometime. And how in the world does the great p get those colored bollinger bands? That would be a nice visual to incorporate into SF5 sometime. Along with a long awaited useable double bottom scan.
Thanks for all your hard work
art
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
art,
to color your Bbands, rightclick on the BollingerBand, select "edit", then "block diagram". and change the layout as below.
To the default Bband block diagram you have to add the above, below, since true and T/F color blocks.
|
|
Registered User Joined: 7/23/2010 Posts: 84
|
Now that is intimidating P. Isn't there some real code or something I could paste in there? Or perhaps the file for the indicator?
Apologies for being a pain, but I'm not sure I have the knowledge to add all this.
TIA
art
|
|
Registered User Joined: 7/23/2010 Posts: 84
|
Well dog my cats pthegreat. I did it. I figured it out lol !!!
Thanks for the challenge. Now off to bed so I can be fresh and all full of smiles for Church in the morning.
Thanks Again
Art
|
|
Registered User Joined: 7/23/2010 Posts: 84
|
I would encourage you to 'share' this indicator on a chart P. It is a nice invention.
art
|
|
Registered User Joined: 6/15/2008 Posts: 1,356
|
we're going a bit of topic here, so I created a new thread:
http://forums.worden.com/Default.aspx?g=posts&t=49840
I shared a chart, do some experimenting with it and let me know.
thx,
P.
PS, I didnt invent anything (yet). just incorporating existing ideas into SF, and modify it to my trading style.
|
|
Guest-1 |