| Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
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
|
|

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

 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
|
|
|
Guest-1 |