Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

New PriceData method. Get Pricing data for any symbol/timeframe Topic Rating:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Kuf
Posted : Tuesday, February 2, 2010 9:55:49 AM


Administration

Joined: 9/18/2004
Posts: 3,522
This quick run down of the new PriceData function will get you started before we get a chance to update the documentation.

What is it:  A new function call to get pricing data for any symbol and/or timeframe

Why you would use it:  Comparison vs another symbol or timeframe. 

Basic Example:
  This example simply plots the QQQQ for the charts selected bar interval

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Simple Pricing Data
'|******************************************************************

Static customSymbol As PriceScripting
If isFirstBar Then
    customSymbol = PriceData("QQQQ")
End If
plot = customSymbol.value


Dynamic Symbol (Set the symbol from the indicator editor): This example plots the close value for the selected symbol from the indicator editor (defaults to dj-30) for the charts selected bar interval.

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:My Indicator
'|******************************************************************
'# sym = userinput.string = dj-30

Static customSymbol As PriceScripting
If isFirstBar Then
    customSymbol = PriceData(sym)
End If
plot = customSymbol.value


Custom Bar Interval (5 Minute in example): This example expands upon the above and plots the 5 minute bar interval

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:My Indicator
'|******************************************************************
'# sym = userinput.string = dj-30

Static customSymbol As PriceScripting
If isFirstBar Then
    Dim tf As New MinuteTimeFrameProvider
    tf.NumMins = 5
    customSymbol = PriceData(sym, tf)
End If
plot = customSymbol.value


More Notes:
Each of these examples creates a PriceScripting object (defined as a static variable). The price scripting object is the same as the built in Price object, which allows you to call all the methods (netchange/percent change) and child calculations (AVG, STOC) that are available to price. Additionally, this object is interpolated for the current bar. This means the bars will match up when mixing bar intervals and when doing lookback operations.

Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
Flash99
Posted : Saturday, February 13, 2010 3:49:27 PM
Platinum Customer Platinum Customer

Joined: 7/16/2009
Posts: 411
WOW !!! ...
Just tried it, and it's mind blowing !
IMO this is one of the best SF5 new features, if not the best one.

One quick question:
I used it to plot moving averages, using AVG() method. Is there a way to plot Bollinger bands ?

Thank you
lmagaro
Posted : Tuesday, February 16, 2010 6:38:52 PM
Registered User
Joined: 11/20/2004
Posts: 401
When I use the following code to create a real code indicator

'# sym = userinput.string = dj-30

Static customSymbol As PriceScripting
If isFirstBar Then
    customSymbol = PriceData(sym)
End If
plot = customSymbol.value

everything on the chart and volume pane disappears when I click on apply. What am I doing wrong.
lmagaro
Posted : Thursday, February 18, 2010 3:40:41 PM
Registered User
Joined: 11/20/2004
Posts: 401
Still blanks out price history and indicator plots if I use this code.
StockGuy
Posted : Thursday, February 18, 2010 3:41:29 PM

Administration

Joined: 9/30/2004
Posts: 9,187
Must be a bug.  It's been reported to development.
Kuf
Posted : Monday, February 22, 2010 10:53:40 AM


Administration

Joined: 9/18/2004
Posts: 3,522
This has been fixed in 179.

Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
bobre1
Posted : Monday, February 22, 2010 10:56:38 AM
Registered User
Joined: 10/7/2004
Posts: 886
I'm still experiencing the problem in 178.

No vertical scale, not plots.

Only way to get plots back is closing SF and re-starting.

Bob
Kuf
Posted : Tuesday, February 23, 2010 3:42:27 PM


Administration

Joined: 9/18/2004
Posts: 3,522
Yes this has been fixed in 179. Can you tell me if you get this same behavior in 179?

Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
bobre1
Posted : Tuesday, February 23, 2010 3:43:53 PM
Registered User
Joined: 10/7/2004
Posts: 886
I tried the first example and it's working fine.

Bob
bobre1
Posted : Tuesday, February 23, 2010 3:45:51 PM
Registered User
Joined: 10/7/2004
Posts: 886
The second two examples appear to be fine as well.

Bob
lmagaro
Posted : Tuesday, February 23, 2010 9:28:44 PM
Registered User
Joined: 11/20/2004
Posts: 401
I tried writing this in the Class tab with AutoLoop = False like this:

    Sub New
        AutoLoop = False
    End Sub
   
    Public Overrides function Plot() as System.Single
        '******************************
        '* Relative Strength To Index *
        '******************************
        '# sym = userinput.string = SP-500
        Dim CustomSymbol As PriceScripting
        For i As Integer = 0 To Price.Bar.Count - 1
            If i = 1 Then
                CustomSymbol = PriceData(sym)
            End If
            Dim RS As Single = Price.Bar.Value(i) / CustomSymbol.Bar.Value(i)
            AddToOutput(Price.Bar.DateValue(i), RS)
        Next
    End Function

I get no plot however. What must I change to get it to work?
   
jas0501
Posted : Tuesday, February 23, 2010 9:38:42 PM
Registered User
Joined: 12/31/2005
Posts: 2,499

This could be relly cool. Using autoloop=False and a string of multiple symbols one could compose a survey and then for each symbol plot using the survey value information. For example daily rank or correlation or whatever...

A very very rough sketch of the idea.....



Sub New
  autoloop = False
 End Sub
    Public Overrides function Plot() as System.Single
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 4.9
www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:symbol list example
'|******************************************************************
'# symbolStrs = userinput.string = "IBM,INTC,HPQ"

Static symbols() as string
Dim sym As String
Static startedYet As Boolean
Static customSymbol As priceScripting
Static surveyInfo() as something
If Not startedYet Then
 '
 ' compose the survey information once at the start
 '
 symbols = microsoft.visualbasic.split(symbolStrs, ",")
 For Each sym In symbols
  customSymbol = PriceData(sym)
  showmessage("=>" & customsymbol.symbol & "<=" & " sym=" & sym & _
   " count =" & customsymbol.count & _
   " Open(1)=" & customsymbol.bar.openvalue(1))
  For I As Integer = 0 To  customsymbol.count - 1
   '
   ' Do whatever survey composition and have it available for each symbol
   '
         ...... customsymbol.bar.openvalue(i) ..... 
  Next I
 Next
 startedYet = True
End If
'
' do normal autoloop= false plot processing here 
'       by adding references to the survey info composed above
'       in the code below
'

For i As Integer = 0 To price.count -1
    MyBase.AddToOutput(price.bar.datevalue(i), _
         price.bar.OpenValue(i), _
         price.bar.highValue(i), _
         price.bar.lowvalue(i),
         price.bar.value(i))
Next
end function
end class


A couple comments...
1. a minor bug: customSymbol.symboll returns an empty string
2. as some point it sure would be nice to have access to the watchlist symbols so passing in the symbol list could be replaced with referencing the watchlist symbols



Kuf
Posted : Wednesday, February 24, 2010 9:32:39 AM


Administration

Joined: 9/18/2004
Posts: 3,522
You could acheive number 2 by creating the survey calc in it's own indicator and then making a market index out of it. In fact that would be the preferrable method.


Ken Gilb (Kuf)
Chief Software Engineer - Worden Brothers Inc.
Try/Catch - My RealCode Blog
cdurso
Posted : Thursday, October 14, 2010 6:34:44 PM
Gold Customer Gold Customer

Joined: 12/30/2004
Posts: 29

How do I get BackScanner to buy inside the signal bar?  If my signal is based on the high or low of the previous bar how do I tell it to buy or sell at that price and have it trade 'inside' the signal bar?

cdurso
Posted : Thursday, February 2, 2012 1:33:02 AM
Gold Customer Gold Customer

Joined: 12/30/2004
Posts: 29
How do I reference monthly or quarterly data from a daily or weekly chart?
Bruce_L
Posted : Thursday, February 2, 2012 7:07:08 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

A trade in BackScanner can only be executed on the Open, High, Low, Close or midpoint of the bar specified in the BackScanner Rule. It is not possible to executue the trade at any other point in the bar.

The following RealCode demonstrates referencing Monthly Prices:

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Monthly Price
'|******************************************************************
Static customSymbol As PriceScripting
If isFirstBar Then
    Dim tf As New MonthlyTimeFrameProvider
    tf.NumMonths = 1
    customSymbol = PriceData(CurrentSymbol, tf)
End If
OpenValue = customSymbol.Open
HighValue = customSymbol.High
LowValue = customSymbol.Low
Plot = customSymbol.Last

The following RealCode demonstrates referencing Quarterly Prices:

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Quarterly Price
'|******************************************************************
Static customSymbol As PriceScripting
If isFirstBar Then
    Dim tf As New MonthlyTimeFrameProvider
    tf.NumMonths = 3
    customSymbol = PriceData(CurrentSymbol, tf)
End If
OpenValue = customSymbol.Open
HighValue = customSymbol.High
LowValue = customSymbol.Low
Plot = customSymbol.Last



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
caution
Posted : Tuesday, June 21, 2016 2:42:08 PM
Registered User
Joined: 5/5/2010
Posts: 185

How can i rewrite a price/volume indicator assumeing above code (dynamic symbol from Kuf) is valid, no timeframe?

 

 

caution
Posted : Tuesday, June 21, 2016 6:46:08 PM
Registered User
Joined: 5/5/2010
Posts: 185

never mind.

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.