Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Label property for RealCode Conditions Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Kuf
Posted : Friday, April 16, 2010 10:30:10 AM


Administration

Joined: 9/18/2004
Posts: 3,519
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 845 time(s).



Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
Kuf
Posted : Friday, April 16, 2010 12:06:24 PM


Administration

Joined: 9/18/2004
Posts: 3,519
Also, the bars ago parameter is supported in RealCode indicators.

Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
Winnie
Posted : Friday, April 16, 2010 3:28:16 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 1,006
Thanks Kuf, thats very cool!

Winnie
runningdawgcaptlst1
Posted : Friday, April 16, 2010 3:30:27 PM
Platinum Customer 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?
Winnie
Posted : Friday, April 16, 2010 4:09:39 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 1,006
For now, lets KISS
Winnie
Posted : Sunday, April 18, 2010 10:03:34 AM
Platinum Customer Platinum Customer

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?
Kuf
Posted : Monday, April 19, 2010 10:21:33 AM


Administration

Joined: 9/18/2004
Posts: 3,519
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
Kermitp
Posted : Monday, April 19, 2010 11:56:21 AM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 361
Ken , this sounds great. My question is can I test the value of the label in a condition (rule)?
Kuf
Posted : Monday, April 19, 2010 2:49:06 PM


Administration

Joined: 9/18/2004
Posts: 3,519
Test it in a different condition?

Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
Kermitp
Posted : Monday, April 19, 2010 4:18:03 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 361
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
pthegreat
Posted : Monday, April 19, 2010 9:11:22 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
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

BeechTop
Posted : Monday, April 19, 2010 10:51:51 PM
Gold Customer Gold Customer

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.
Kuf
Posted : Wednesday, April 21, 2010 12:02:20 PM


Administration

Joined: 9/18/2004
Posts: 3,519
pthegreat this has been fixed for the next build.

Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
pthegreat
Posted : Friday, April 23, 2010 9:11:02 AM

Registered User
Joined: 6/15/2008
Posts: 1,345
Kuf, It's working again with the new updated version. Thx!!
pthegreat
Posted : Saturday, April 24, 2010 10:51:47 AM

Registered User
Joined: 6/15/2008
Posts: 1,345
Now the label property doesn't work anymore.
Kuf
Posted : Sunday, April 25, 2010 8:37:37 AM


Administration

Joined: 9/18/2004
Posts: 3,519
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
pthegreat
Posted : Sunday, April 25, 2010 12:19:38 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
sorry, my mistake, i was referring to your code. first post in this thread. it is working.
pthegreat
Posted : Monday, April 26, 2010 7:18:41 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
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.
pthegreat
Posted : Monday, April 26, 2010 7:28:53 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
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.
pthegreat
Posted : Monday, April 26, 2010 7:36:23 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
well wadda ya know, it is working,  cool!

stoptxt = "stop=" & stoploss
   label(I) = stoptxt


guess I forgot the spaces between the "&"
Kuf
Posted : Tuesday, April 27, 2010 9:53:23 AM


Administration

Joined: 9/18/2004
Posts: 3,519
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
pthegreat
Posted : Friday, April 30, 2010 9:47:08 AM

Registered User
Joined: 6/15/2008
Posts: 1,345

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



pthegreat
Posted : Friday, April 30, 2010 9:54:20 AM

Registered User
Joined: 6/15/2008
Posts: 1,345
nevermind, I got it.
For I As Integer = 0 To 4   did it.

sorry, should think a little more, before I post.
Kermitp
Posted : Tuesday, August 10, 2010 12:21:23 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 361

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 & "%"

Kermitp
Posted : Tuesday, August 10, 2010 12:44:29 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 361
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.
Kermitp
Posted : Thursday, August 12, 2010 11:12:08 AM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 361
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
jas0501
Posted : Thursday, August 12, 2010 12:03:21 PM
Registered User
Joined: 12/31/2005
Posts: 2,498
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.
Kermitp
Posted : Thursday, August 12, 2010 12:42:01 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 361
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
pthegreat
Posted : Thursday, August 19, 2010 7:30:41 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
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.

pthegreat
Posted : Thursday, August 19, 2010 7:31:51 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
sorry, for bearish above the bar, bullish below the bar.
Kermitp
Posted : Tuesday, August 24, 2010 12:38:48 PM
Platinum Customer Platinum Customer

Joined: 10/7/2004
Posts: 361
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

jas0501
Posted : Tuesday, August 24, 2010 1:18:20 PM
Registered User
Joined: 12/31/2005
Posts: 2,498
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 & "%"


jas0501
Posted : Tuesday, August 24, 2010 1:27:09 PM
Registered User
Joined: 12/31/2005
Posts: 2,498
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.
pthegreat
Posted : Monday, August 30, 2010 2:24:09 PM

Registered User
Joined: 6/15/2008
Posts: 1,345

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.

Art Lindsley
Posted : Saturday, November 20, 2010 6:55:09 PM
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
pthegreat
Posted : Saturday, November 20, 2010 11:54:53 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
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.

Art Lindsley
Posted : Sunday, November 21, 2010 12:01:32 AM
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
Art Lindsley
Posted : Sunday, November 21, 2010 12:53:56 AM
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
Art Lindsley
Posted : Sunday, November 21, 2010 9:34:52 AM
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
pthegreat
Posted : Sunday, November 21, 2010 12:08:07 PM

Registered User
Joined: 6/15/2008
Posts: 1,345
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.

Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.