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 |

Realcode Price vs Moving Avg Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
austincarr
Posted : Sunday, November 10, 2013 7:22:30 PM
Registered User
Joined: 6/2/2005
Posts: 11

I want to compare Price to a Moving average intraday, but have found the Moving Average only recognizes its Value 6 bars back.  I was trying to look at its Value thirteen bars back.  The problem is in a Realcode formula If MA,Value(13) > Price.Close,value(13) and MA.Value < Price.Close then pass.  It will only return positives up to MA,Value(6).  Any ideas why I can not go back 13 Bars?

Bruce_L
Posted : Wednesday, November 13, 2013 9:47:37 AM


Worden Trainer

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

The syntax does not look valid. There should be a period where the first comma is currently and it should be Price.Close(13) and not Price.Close,value(13).

If MA.Value(13) > Price.Close(13) AndAlso MA.Value < Price.Close Then Pass


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
austincarr
Posted : Wednesday, November 13, 2013 4:49:15 PM
Registered User
Joined: 6/2/2005
Posts: 11

Bruce,

Sorry for the typos.  Of course I would get an error message if had those commas where periods should be, so there are no commas in the code.  Saying that if can not get a positive return If the MA.Value look back period is greater than (6)

MA.Value(6) > Price.Close(13) And MA.Value < Price.Close Then Pass

That works

MA.Value(7) > Price.Close(13) And MA.Value < Price.Close Then Pass

Does not return any positives.  

Footnote: '# MA = chart.MovingAverage

 

Bruce_L
Posted : Monday, November 18, 2013 3:23:01 PM


Worden Trainer

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

You haven't indicated the period of the moving average used, but if I use a 30-Period Simple Moving Average with a Daily Time Frame, the following RealCode Condition returns true for 5 symbols in the Standard and Poors 100 Component Stocks Watchilst.

DOW, UTX, UNH, MRK & UNP

If MA.Value(7) > Price.Close(13) AndAlso MA.Value < Price.Close Then Pass

But if I actually adjust the bars ago parameters to match at 7 instead of using 7 and 13, I get 13 symbols.

AMGN, MET, BRKB, DOW, COF, BAX, JPM, UNH, C, MON, IBM, BAC & MRK

If MA.Value(7) > Price.Close(7) AndAlso MA.Value < Price.Close Then Pass

I have absolutely no idea why you would not get any symbols returning true.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
check9255
Posted : Monday, November 12, 2018 10:19:07 AM
Gold Customer Gold Customer

Joined: 4/19/2012
Posts: 7

I HAVE BEEN SCANNING USING MOV AVG CROSS OVERS.

WHEN I GET THE SCANS, THEY ARE ABOUT 8 TO 10 BARS PAST TH CROSS OVER.

IS THERE A PCF THAT WILL SHOW THE CROSS OVER IN ONE OR TWO BARS?

THANKS

Bruce_L
Posted : Thursday, November 15, 2018 10:31:23 AM


Worden Trainer

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

If you are using the built in crossing conditions, it should only return true on the exact bar of the cross. Please contact technical support.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
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.