Platinum Customer
Joined: 2/24/2013 Posts: 16
|
Hello,
I'm having trouble importing an indicator that someone else has written into the real code editor to use for some math etc. Long story short if the current bar is higher than the previous bar in terms of the value of this indicator I want it to return a 1 and if it is lower a -1. That part I have worked out as I use it for other standard indicators like a moving average or a MACD histogram.
However, when I try to import this indicator it gives an "Identifier Expected" error and I haven't even written any code yet. It says it is on line 20 and 26.
My best guess is that the parameters for the indicator are being asked for but I can't get to them. I know the indicator was done in real code before by the author but I can't seem to get to the code to look at it. If I could rewrite the code in a fresh indicator that might work. It was originally done in Telechart so not sure what the code would be now in Stockfinder. Here's what I have though:
3C Code
So, here’s the code. Go into TeleChart and select “add indicator”, then select “custom” and then select “cumulative”. I always plot 3C in the top window with price. Make sure you check “visible” and set the smoothing average to “1”, which is no smoothing so simple/expo won’t matter as there is no smoothing. Then in the “up condition” box, put this code: tsv55>tsv55.10 Then in the “down condition” box, use this code: tsv55
The code I gave you is a bit of a longer-term indicator, good for weekly, daily and hourly charts. It’ll work good for the minute charts as well, however I prefer to use something a bit faster. For intraday charts, I’ve been using these codes in the up condition/down condition boxes: tsv2>tsv2.20 / tsv2 ”=greater than and the “.20” =20 bars ago. So feel free to play with the code and see what you come up with, the basic premise is the indicator is looking at its position now as compared with its position (x) number of bars ago, and thus a sort of trend. A longer TSV will better reflect a long-term trend while a shorter TSV will better reflect net accumulation/distribution, but it isn’t as great at looking at longer-term trends.
1 hour
Cumulative(tsv>tsv.10,tsv<tsv.30,1+1)1 Period
Any help you can provide would be fantastic.
Thank you,
Connor
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
I can get to the block diagram if that helps.
http://imgur.com/21pXF9r
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
Ok I've fixed the errors coming up. The real code doesn't like indicators described with a number in the front. The problem I have now is that it will not plot anything.
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.1 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:EI
'|*** Example: plot = price.close - price.close(1)
'|******************************************************************
'# CCC = indicator.MyLibrary.3C as F2 in TC
Dim Elder3 As Integer
Select Case Elder3
Case CCC.XAVG(13) > CCC.XAVG(13, 1)
Elder3 = -1
Case CCC.XAVG(13) < CCC.XAVG(13, 1)
Elder3 = 1
End Select
plot = Elder3
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
OK
Thanks for getting this far. I have fixed all the above issues by remaking the 3C in real code.
The problem I have now is that my real code indicator in the above post that is based on my remake of 3C is crashing Stockfinder everytime I try to run the code. Seems like a stack overflow so now I'm stuck again.
Thanks
|
Platinum Customer
Joined: 2/24/2013 Posts: 16
|
Solved
I was running the above code along with some simlar code to generate an indicator that would range in values of 3, 1, -1, and 0. Basically Elder Impulse with 3C added in as a third qualifier. The problem was that if I coded both components of Elder Impulse and the component of 3C it would stack overflow and crash.
The solution was to just code the EI components and 3C component separately and then drag them together to do a Plot Comparison and select Add.
The end result is what I was after and doesn't seem to crash the program yet.
Sorry for a now useless post but maybe people can learn from my amateur fumbling around.
Thanks again.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am happy to read you were able to figure this out on your own. I'm even happier that you documented your progress in the forums.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|