Back

Forex indicator plotting question

Hello,

I have a question on plotting forex indicators for multiple pairs using loops. I can't seem to produce any more indicators than the final pair in my list, which in this case is "EURJPY". Does anyone have advice on how to go about fixing this?

Thank you,

Mitch

Update Backtest








0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


The reason why you can't produce any more indicators than the final pair in the list, is because the code keeps on overriding self,macd, self.sma and self.rsi. In order to save the objects once created, try creating a SymbolData object like so:

class SymbolData(object):
def __init__(self, symbol, macd, sma, rsi):
self.Symbol = symbol
self.MACD = macd
self.SMA = sma
self.RSI = rsi

This SymbolData object can be stored in a dictionary that is keyed by the symbol just like self.Data in the above code. This way the indicators for each symbol will be properly stored. The backtest below shows a possible implementation.

0


Thanks for the response, I see that the information is being shown in the console now but there are no plotted indicators anymore as the code showed before. Is it possible to plot an indicator based on the stored data in the new object now? One for each pair, that are interchangable through the stock(plot) backtest dropdown?

 

i added two new lines of code to show my intention but am still having override issues causing only my final (EURJPY) indicator being plotted

cheers,
Mitch

0


Hi Mitch,

It is possible to plot the Indicators for each SymbolData object, but perhaps not in the exact way you're imagining. I've attached a backtest that demonstrates how to create three different Chart objects, one for each type of Indicator. Then, there is a method to plot each Indicator of a SymbolData object in the appropriate Chart. Take a look at the backtest and if that doesn't answer your question, let us know and we'll do our best to help!

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed

 
";