I have established an indicator library as described in
QUOTE:
Creating an Indicator Library in Wealth-Lab Pro
which works well. However I did not succeed accessing a common indicator like SMA within the constructor of my custom indicator. Adding the "using WealthLab.Indicators" clause did not help. Could anyone make an example of a constructor of a custom indicator that just duplicates (i.e. calls) an already existing indicator?
Second Question: Assume that I have a custom indicator called SMA_uni, and its constructor looks like this:
CODE:
Please log in to see this code.
This construction works well. Now i want to make another custom indicator called TriMA_uni that uses SMA_uni:
CODE:
Please log in to see this code.
You see, one difference to the above example is the fact that this indicator does not calculate each bar individually but accesses an already existing indicator. However, this construction is not allowed. This assignement gives the error that "this" is read only. Now if I put it this way:
CODE:
Please log in to see this code.
it doesn't work either. For whatever reason all data in "ds" are zero after coming back to the strategy's calling code.
Any hints?
Size:
Color:
QUOTE:
Could anyone make an example of a constructor of a custom indicator that just duplicates (i.e. calls) an already existing indicator?
Someone has already made an example - even better: there are
tons of pointers in the open source code of the Community Indicators project:
Home - Community IndicatorsLog in to the Wiki, grab the attachment, and perform a text search within solution. I see SMA.Series alone being references in 12 classes.
Size:
Color:
QUOTE:
Second Question: Assume that I have a custom indicator called SMA_uni, and its constructor looks like this:
This is not going to work neither way. You should assign values on a bar by bar basis.
CODE:
Please log in to see this code.
Size:
Color:
Thank you very much for your help. I was just missing a reference, and I was misled through the fact that the corresponding "using" statement showed no error.
Size:
Color:
Second Question reply: This is a pity, as it can lead to multiple unneccessary processing and overall slowdown of the strategy and backtesting. Are you sure that there is no simpler way?
Size:
Color:
Both the open source examples and the inidicator API tutorial teach you how to save an indicator's instance to the Cache and return its cached copy. If you do everything according to the examples provided, there will be no "slowdown of the Strategy" and no "unnecessary processing". Please just follow the examples, and do as I suggested. Every indicator out of those several hundreds that we already have, does what you're opposed to, and as you see, there ain't nothing like what you described.
Size:
Color:
I have searched the WL and Wiki webpages but not found an indicator API tutorial. Where can I find it?
Size:
Color:
Size:
Color: