Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 5/16/2010 Posts: 33
|
hello,
I'd like to have an indicator that I can sort with which will show me a 1 when pivot detector oscillator is greater than 0 and a -1 when it is less than zero.... When I import the PDO into real code and save I crash the program?
|
|
Registered User Joined: 5/16/2010 Posts: 33
|
sorry... that should be above or under 50 (not zero)... and pivot detector oscillator period 2 (or adjustable?)
|
|
Registered User Joined: 5/16/2010 Posts: 33
|
I think I did it but as a condition... (problem is I don't know how I am doing it re datevalue stuff.) can you check it out? ("warn"s are left over from plot attempt)... thanks...
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:!_pivot & 10ma XUP
'|*** Example: if price.percentChange > 1 then pass
'|******************************************************************
'# PDO = indicator.Library.Pivot Detector Oscillator
Dim warn As Single
Static Days As Integer
If isFirstBar Then
warn = Single.NaN
Days = 0
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
Days += 1
warn = 0
End If
If days >= 2 Then
If price.High() > price.XAVG(10) And price.low() < price.XAVG(10) Then
If price.Close(1) < price.XAVG(1.10) And pdo.AVG(1) > 50 Then
warn = 1
pass
End If
End If
End If
|
|
Registered User Joined: 5/16/2010 Posts: 33
|
p.s. looks for PDO above 50 and price crossing 10 MA up... Is there a better way to do the 10ma cross up?
|
|
Registered User Joined: 5/16/2010 Posts: 33
|
with correction on ma:
'# PDO = indicator.Library.Pivot Detector Oscillator
Static Days As Integer
If isFirstBar Then
Days = 0
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
Days += 1
End If
If days >= 2 Then
If price.High() > price.XAVG(10) And price.low() < price.XAVG(10) Then
If price.close(1) < price.XAVG(10.1) And pdo.AVG(1) > 50 Then
pass
End If
End If
End If
and crossing down with low pdo:
'# PDO = indicator.Library.Pivot Detector Oscillator
Static Days As Integer
If isFirstBar Then
Days = 0
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
Days += 1
End If
If days >= 2 Then
If price.High() > price.XAVG(10) And price.low() < price.XAVG(10) Then
If price.Close(1) > price.XAVG(10.1) And pdo.value() < 50 Then
pass
End If
End If
End If
|
|
Registered User Joined: 5/16/2010 Posts: 33
|
cleaning up the other lines left over from indicator attempt, they become really simplified:
'# PDO = indicator.Library.Pivot Detector Oscillator
If price.High() > price.XAVG(10) And price.low() < price.XAVG(10) Then
If price.close(1) < price.XAVG(10.1) And pdo.AVG(1) > 50 Then
pass
End If
End If
--------------------------
'# PDO = indicator.Library.Pivot Detector Oscillator
If price.High() > price.XAVG(10) And price.low() < price.XAVG(10) Then
If price.Close(1) > price.XAVG(10.1) And pdo.value() < 50 Then
pass
End If
End If
------------------------------
I guess I'd still like to see how you would make it into a yes/no indicator; and how and why datevalue variables are used... I could not find adequate info in the references I looked at, and inappropriate indicators always crash the program...
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
There's a bug that crashes the program when you import PDO directly into the code using the Import Indicator button. But if you add it to your chart first you can drag it into the code editor and it will work fine. This has been reported to development.
This is the code that you originall asked for in your initial post. You can see that PDO was dragged in from the chart.
'# PDO = chart.PivotDetectorOscillator
If PDO.value > 0 Then
plot = 1
Else If PDO.value < 0 Then
plot = -1
End If
|
|
Registered User Joined: 5/16/2010 Posts: 33
|
thank you.
please note that in my SF5, it worked the other way around i.e. it crashed when I dragged indicator from chart and it is doing OK with the PDO imported.... So maybe the bug is something else... Here is the code that is working O.K. ( pdo.avg(1) just gets current bar's value... since it is working, I am not touching it :) )
'# PDO = indicator.Library.Pivot Detector Oscillator
If price.High() > price.XAVG(10) And price.low() < price.XAVG(10) Then
If price.close(1) < price.XAVG(10.1) And pdo.avg(1) > 50 Then
pass
End If
End If
|
|
Guest-1 |