Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/6/2014 Posts: 34
|
Hi,
I created an indicator with realcode like this
plot = (price.Close - price.Open )/(price.High -price.Open )
However it wouldn't plot, what may be the issue?
Thank you
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
It's plotting fine for me in StockFinder 5. I'm not sure what the problem might be.
Is it not plotting on any stock or one in particular?
|
|
Registered User Joined: 10/6/2014 Posts: 34
|
It is not plotting on any stock
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
Does the RealCode editor show any errors?
|
|
Registered User Joined: 10/6/2014 Posts: 34
|
No, it doesn't, it just draws blank. However a number does show on the right like a scale I guess, but no lines are drawn
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
Cick Share > Email Layout and send your layout to support@worden.com and we'll take a look.
|
|
Registered User Joined: 10/6/2014 Posts: 34
|
I sent it
Thank You
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
We haven't gotten it yet. Try sending a test email from the same email account to support@worden.com.
|
|
Registered User Joined: 10/6/2014 Posts: 34
|
I sent the test and email
and I sent the layout once again.
Thank You
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
OK, we got it that time. Thanks.
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
The problem is a division by zero error when two values are equal. Try this:
plot = ((price.Close - price.Open) + .00001) / ((price.High - price.Open) + .00001)
|
|
Registered User Joined: 10/6/2014 Posts: 34
|
It does not plot properly. It plots a straight line on a certain value like 0.18, but then has drops that drops into the -250k, -500k.
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
It's plotting correctly. Keep in mind when the High and the Close are equal, your divisor is going to be .00001 which is going to result in large values. Before we added the +.00001, it was trying to divide by 0 which isn't possible. Edit the scaling on the plot and set manual max and min values for the scale. Set the max to 1 and the min value to -10 and see how that looks.
Maybe if you tell us what you're goal is we can approach it in a different way.
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
You can also try this code which makes the divisor 1 if the High and Open are equal. If they are equal then the value of the indicator will be (Close - Open) + .0001.
Dim Divideby As Single
If price.high = price.Open Then
Divideby = 1
ElseIf price.High > price.open Then
Divideby = (price.high - price.close) + .0001
End If
plot = (price.Close - price.Open) + .0001 / Divideby
You'll probably need to play around with the Min and Max scales values using this method as well.
|
|
Guest-1 |