How to create a new PPO indicator and Strategy Rule PPO crosses Signal Line
Author: Petrus3058
Creation Date: 7/27/2014 11:22 PM
profile picture

Petrus3058

#1
Hi,
I need some help as my programming experience is limited. The PPO Community Indicator only displays a histogram. I would like to additionally show the two moving averages to see the PPO crossing above/below the Signal Line. Looking at the PPO and MACD, I combined the code to what I think is correct as shown below.

Questions:
1) Can someone confirm if my codification of the PPO histogram & moving averages is correct?
2) How do we compile code and use as an indicator (not a strategy) either as a personal indicator or include in the Community Indicators.
3) I think this indicator would be beneficial to others. What is the process to submit indicator code for consideration into the Community Indicator library?
4) I would like to use this PPO indicator in the Strategy Rules conditions. i.e. Enter/Exit when the PPO crosses above/below the Signal Line similar to the MACD. Can someone help with this?

As a newbie, I really would like to run my strategies from Rules rather than Code as I have multiple conditions, indicators and a lot of trial and error testing. All assistance is greatly appreciated.
Thank you.

Source with indented parenthesis attached.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Hi,

1. Yes, they're correct. Below please find a slightly cleaned up version of your code above (Rule Wizard may create superfluous references to the same indicator when adding several buy/sell rules).

2.1. Wealth-Lab Version 6 (.NET) Development Guide > Create an Indicator Library
2.2. Community Indicators publishing requirements. Sorry but since it takes only 1-2 operations, it doesn't qualify.

3. Based on (little to no) demand from users, I'd suggest starting out by including this indicator in your own indicator library. BTW, there are numerous helpful forum posts on Visual Studio or SharpDevelop usage in creating custom indicator libraries.

4. That would be quite problematic since the indicator isn't formal (i.e. exists in Strategy code rather in an indicator library) and there's no specific set of PPO conditions like there is for MACD in Rule-based strategies. Therefore I'd propose that you create a rule-based strategy as if you were using MACD, then click "Open code in new strategy window" and edit the output code accordingly i.e. replace MACD with PPO. Should be pretty easy.

P.S.

CODE:
Please log in to see this code.
profile picture

Petrus3058

#3
Thank you for your help and guidance Eugene. This is very helpful.
Regards.
profile picture

Petrus3058

#4
Hi,
I need a little more help. Thanks to Eugene's guidance I have installed VS Express 2013 and have learned how to create my personal indicator library. However, I'm still struggling, trying to convert the above PPO strategy with moving averages into an indicator. I've looked at the wiki indicator library source files to borrow ideas from PPO and other indicators but don't understand how to combine & display the histogram and moving averages together. Can someone help and convert Eugene's PPO code (above) to indicator source code? Any comments on how to combine and display indicators would be appreciated. Strategies use PlotSeries, but how do indicators get displayed in WLP?
Thank you.
profile picture

Eugene

#5
At what stage you are and what is the obstacle? What are you struggling with, precisely?

Have you reviewed the convenient examples: Creating an Indicator Library PDF and Community Indicators Source Code?
profile picture

Petrus3058

#6
Yes, I keep rereading these two documents, and they're very helpful. I created my own custom indicator library using sample code and am converting the MyPPO Class from WealthScript strategy to a DataSeries indicator. Specifically, within the indicator class, I'm trying to understand how to plot both the PPO histogram and two moving averages. This is where I'm at:
CODE:
Please log in to see this code.

This is followed by my helper class.

From the strategy MyPPO WealthScript class in your prior post (above), I'm trying to incorporate the following but don't clearly understand how the indicator DataSeries class implements plotting to thus plot the histogram and moving averages at the same time
CODE:
Please log in to see this code.


Thank you for asking the question and teaching me how to fish. - I haven't been programming for 15yrs, but it's coming back.
Regards.
profile picture

Eugene

#7
QUOTE:
Specifically, within the indicator class, I'm trying to understand how to plot both the PPO histogram and two moving averages

You can't. A formal indicator can be used to plot just a single DataSeries.

What you need is to create 2 more classes in your library: say MyPPOHist and MyPPOSignal e.g.

CODE:
Please log in to see this code.


CODE:
Please log in to see this code.


(Warning: may contain mistakes due to on-the-fly coding.)

Then you can refer to them in your Strategy one by one (MyPPO, MyPPOHist, and MyPPOSignal). Of course, each one has to have a Helper class to be visible on the Indicators list.
profile picture

Petrus3058

#8
Thank you for the prompt response. I'll give it a try.