Profile Picture

Struggling with implementing a new class

Posted By willy 5 Years Ago
Posted Friday April 13 2012
Hi Daniel, Billb,

since some days I’m struggling with implementing a new class which should help me to detect japanese candlestick pattern.
In a first step I implemented all the functions in the symbolscript class and it is working fine. But now I want to move all these functions into a separate class for reusing them in other trading systems.
Most of the candle properties like body, uppershadow, lowershadow etc. are implemented as series like SubtractSeries, AddSeries etc. These classes are based on SeriesCalculatorBaseSimple.

Protected Friend candleRange As SubtractSeries ' High - Low
Protected Friend candleRangeMid As DivideSeries ' Low + candleRange / constant2

Protected Friend shadowUpper As SubtractSeries ' High - bodyHigh
Protected Friend shadowLower As SubtractSeries ' bodyLow - Low
Protected Friend shadowLentgh As AddSeries ' shadowUpper + shadowLower

I also need some SMA’s in that basic class.
Protected Friend daySMAPeriode As Integer
Protected Friend longDaySMA As SMA
Protected Friend shortDaySMA As SMA

I imagine having a basic class which implements all candle properties like body, uppershadow, lowershadow and so on as described above.
Then my idea was to build each candlestick pattern as a new class which inherits the basic class to have all the candle properties in this new class too. In the CalcNewValue function I implemented the individual code for each candlestick pattern. I started with the basic pattern which consists of only a single bar like Black and White Marubozu, Black and White Closing Marubozu etc. In a first step I used these indicators per drag and drop on a chart and they are working fine. But what is not working is the SMA which never contains any values!

May be I’m on a wrong way implementing such candlestick pattern?! In my trading system all these are implemented as functions returning a boolean value.

How would you start implementing such things?


Edited: Friday April 13 2012 by willy
Posted Friday April 13 2012
When you put an indicator in your symbol script, the IndicatorManager automatically discovers it. (See this post for some details.)

If you want to use an indicator from within another indicator, then this post shows how to do so: Indicators inside indicators


Similar Topics

Reading This Topic

2005-2017 © RightEdge Systems