msayem1 / trade-manager

Automatically exported from code.google.com/p/trade-manager
0 stars 0 forks source link

Adding custom indicators #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
How would I add a custom indicator. For instance a MACD indicator.

I added and entry in configuration > codetype. 
I wrote a class similar to the Moving average (with method updateseries) and 
the java code compiles.

Howeve when I look for the indicator in configuration > strategy > (lower 
table), I donot see my newly created indicator. 

On a related note, can I access other indicators associated with the stategy 
from within an indicator-class. Eg, from within the MACDSeries class, can I 
access <parent>.getMAseries(0) to get the 1st moving average to be used in the 
MACD ?

Original issue reported on code.google.com by kri....@gmail.com on 20 Mar 2014 at 10:29

GoogleCodeExporter commented 9 years ago
You need to add the MACD to the src/org/trade/ui/trade.properties file. No you 
cannot access other indicators from within and indicators. 

Original comment by simon.allen on 21 Mar 2014 at 1:27

GoogleCodeExporter commented 9 years ago
Best match is the bollinger band which has a Dataset with two series you need 
four series. Fast Moving EMA, Slow Moving EMA, Signal Smoothing and Signal 
Line. I will add MACD in a future release.

MACD Line: (12-day EMA - 26-day EMA) 

Signal Line: 9-day EMA of MACD Line

MACD Histogram: MACD Line - Signal Line

Original comment by simon.allen on 21 Mar 2014 at 3:28

GoogleCodeExporter commented 9 years ago
Ok if you do a Git/pull you will see MACD indicator I still need to verify the 
values.

Original comment by simon.allen on 21 Mar 2014 at 8:27

GoogleCodeExporter commented 9 years ago
Hi Simon

Thanks for the update. 
However when I try to use the indicator, I get the error "Fast MA must be 
greater than zero.". (I get a similar error with the BollingerBands). 

I dug a little deeper:
The loop in getValueCode () > for (CodeValue value : this.getCodeValues())... 
doesnt execute properly. 
It appears getCodeValues() returns a null value (the variable codeValues is 
null).

thanks

Original comment by kri....@gmail.com on 21 Mar 2014 at 11:10

GoogleCodeExporter commented 9 years ago
Work around: When adding new indicators, open properties to "change" the values 
from the default values.

Quick update: 
There appears to be a bug. When adding new indicators, the program doesnot read 
the indicator properties correctly (which leads to the "Fast MA must be greater 
than zero." error or similar). You need to click on the properties and change 
(or atleast do some modifications of the properties) and save. 

thanks

Original comment by kri....@gmail.com on 22 Mar 2014 at 12:00

GoogleCodeExporter commented 9 years ago
Actual you just need to click on the properties and save then it works fine. 
Current build has been updated with the MACD indicator.

Original comment by simon.allen on 22 Mar 2014 at 3:51