Closed jbax closed 4 years ago
Hello , are you still interested in the implementation of this signal?
Yes
On Fri, Jul 17, 2020, 2:12 AM ChrisTrakas notifications@github.com wrote:
Hello , are you still interested in the implementation of this signal?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uniVocity/univocity-trader/issues/12#issuecomment-659533063, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWFQPVYXPKTEQTGY7GSWETR34UYRANCNFSM4JVZCY7A .
So , I'm trying to implement WAE , but this indicator needs to access previous values. To be specific , a WAE object will cointain one MACD and one BollingerBand object. In the calculate method of WAE though , I need to get the MACD and BollingerBand values of the previous 3 candles. Any ideas on how I could work that out?
Thanks for the help! Use a CircularList of size 3 to store the values of each indicator. It will discard older values.
On Fri, Jul 17, 2020, 11:53 PM ChrisTrakas notifications@github.com wrote:
So , I'm trying to implement WAE , but this indicator needs to access previous values. To be specific , a WAE object will cointain one MACD and one BollingerBand object. In the calculate method of WAE though , I need to get the MACD and BollingerBand values of the previous 3 candles. Any ideas on how I could work that out?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uniVocity/univocity-trader/issues/12#issuecomment-660134877, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWFQPSXCK7NLKCHGUIO4ETR4BNGDANCNFSM4JVZCY7A .
Sure, but how could I use the old and current values simultaneously?
I'm not sure what you mean exactly, if you aren't sure about how to use it take a look at some indicator that uses circularlist:
You can probably go without even using a circularlist, as you only need 3 recent values, just store them in a few attributes, like done here:
Hope this helps.
On Sat, Jul 18, 2020, 2:57 AM ChrisTrakas notifications@github.com wrote:
Sure, but how could I use the old and current values simultaneously?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uniVocity/univocity-trader/issues/12#issuecomment-660240556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWFQPXB4UY546I35QVC64DR4CCWNANCNFSM4JVZCY7A .
Ops I meant to link this for the example that uses circularlist: https://github.com/uniVocity/univocity-trader/blob/master/univocity-trader-core/src/main/java/com/univocity/trader/indicators/InstantaneousTrendline.java#L14
On Sat, Jul 18, 2020, 3:24 AM Jeronimo Backes jbax@univocity.com wrote:
I'm not sure what you mean exactly, if you aren't sure about how to use it take a look at some indicator that uses circularlist:
You can probably go without even using a circularlist, as you only need 3 recent values, just store them in a few attributes, like done here:
Hope this helps.
On Sat, Jul 18, 2020, 2:57 AM ChrisTrakas notifications@github.com wrote:
Sure, but how could I use the old and current values simultaneously?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uniVocity/univocity-trader/issues/12#issuecomment-660240556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWFQPXB4UY546I35QVC64DR4CCWNANCNFSM4JVZCY7A .
Okay I will check them out. What I meant was , lets say that you want to get the output of the WAE in the current moment. To calculate this , you need to use the MACD values from the past 3 candles. If for example we are in the 1 hour timeframe , to get the WAE value for 15.00 we also need to use the MACD values from 14.00 , 13.00 , 12.00 . I haven't figured out how to do that yet.
The examples should help you. First keep in mind all calculations are performed on the fly and there is no internal list of candles you can navigate. Unless you explicitly add stuff to circularlists.
Then you'll probably want to extend from SingleValueIndicator and override the process method (I'm on mobile so sorry for the bad formatting) :
protected boolean process(Candle candle, double value, boolean updating) { if (updating) { //if your indicator reacts to every tick until a full 1h candle is produced, the most recent value in the list will be updated Macd.accumulate(candle) Macdcircularlist.update(macd. Getvalue() ); } else { // otherwise you add the vale discarding the oldest Macdcircularlist.add(macd. Getvalue() );}
... Calculate the indicator. E. G
MacdcircularList.Getrecentvalue(3) will get the value oldest macd value accumulated if your circularlist is of size 3.
Does that help?
On Sat, Jul 18, 2020, 3:37 AM ChrisTrakas notifications@github.com wrote:
Okay I will check them out. What I meant was , lets say that you want to get the output of the WAE in the current moment. To calculate this , you need to use the MACD values from the past 3 candles. If for example we are in the 1 hour timeframe , to get the WAE value for 15.00 we also need to use the MACD values from 14.00 , 13.00 , 12.00 . I haven't figured out how to do that yet.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uniVocity/univocity-trader/issues/12#issuecomment-660261754, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWFQPQFO2Z72OQK4LWN5U3R4CHPBANCNFSM4JVZCY7A .
Thanks , I got it , the circular list will solve the problem.
Thanks for your PR, I made a few adjustments to make the calculation work correctly. I also added the necessary code to make it display on a chart on the test code I'm putting up together in class ChartWindow
(right click on a chart and select "indicators" to see it). I still need to get it to show up the correct histogram colors. Will hopefully complete that tomorrow.
I'll leave this issue open until I finalize this and also ensure the code handles tick updates to make the last signal of the indicator be updated every time a new tick comes for the last bar.
Sounds good!
All done. Thanks a lot for your contribution!
title