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 |

Bruce, can you code this for me? Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
rcooper1
Posted : Monday, November 28, 2011 10:50:35 AM
Registered User
Joined: 6/25/2010
Posts: 44
Very specific coding request.  I can't seem to make it work, though it should be fairly simple.  Trying to create a pair of indicators, as follows:

(Low Price of Today) - (MA of closing price of prior V1 days)
---------------------------------------------------------------------------------  x 100
                              Low Price of Today



(High Price of Today) - (MA of closing price of prior V1 days)
--------------------------------------------------------------------------------- x 100
                                High Price of Today


Haven't coded up an indicator in a long time, so I am probably just missing a formatting issue somewhere.
Thanks,
Richard
Bruce_L
Posted : Monday, November 28, 2011 11:23:46 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I'm guessing the first indicator would be something similar to the following (assuming V1 is a user adjustable variable):

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:First Indicator
'|******************************************************************
'# V1 = UserInput.Integer = 10
Plot = 100 * (Price.Low - Price.AVGC(V1)) / Price.Low

And the second indicator would be similar:

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Second Indicator
'|******************************************************************
'# V1 = UserInput.Integer = 10
Plot = 100 * (Price.High - Price.AVGC(V1)) / Price.High

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rcooper1
Posted : Monday, November 28, 2011 3:10:38 PM
Registered User
Joined: 6/25/2010
Posts: 44
Thanks.  My only question is, do I need to use an offset of 1  in order to set the time period of the moving average to the PRIOR n days?  I don't want the indicator to use today's last price in the average.  Ifr so, can you show me how to include the variable for offest?
Thanks again.  Richard
Bruce_L
Posted : Monday, November 28, 2011 4:31:35 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
If you wanted to add an offset of 1 to the calculation of the Moving Average, there would be very little change in the RealCode.

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:First Indicator
'|******************************************************************
'# V1 = UserInput.Integer = 10
Plot = 100 * (Price.Low - Price.AVGC(V1, 1)) / Price.Low

And the second indicator would be similar:

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Second Indicator
'|******************************************************************
'# V1 = UserInput.Integer = 10
Plot = 100 * (Price.High - Price.AVGC(V1, 1)) / Price.High

-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.