Please help me with blueshift virtual programming tool. I want to code 50 EMA high, low and close. I tried using the alpha function but there only exponential moving average tab is coming, there is no more specification. Please help me find out EMA HLC
We have implemented the standard indicators available in the ta-lib library - see the documentation here. In this case, the EMA is implemented on the 'close' price. So I think using high and low will not be possible on the visual programming directly as of now. Nonetheless, you can use the visual programming for close only (using three EMA blocks), and then generate the Python code and replace the 'close' with 'high' and 'low' for two of the boxes. For example, you will see the exponential moving average in generated code as something like below
context.ema2[asset] = alpha_function(context.history_1m, asset,
func='exponential_moving_average', kwargs={'lookback': 14})
Replace this with the below (for high, similarly for low)
context.ema2 = ema(context.history_1m.minox_xs(asset).high.values, 14)
This uses the built-in library ema function, so you need to import that as well. Add the below at the very top of the code.
from blueshift_library.technicals.indicators import ema
To access the code generation from visual programming, make sure you are on the full screen mode (see here how to). Then locate the 'view code' link on bottom right. Once you click it, it generates the underlying code from your visual programming. You can directly save it as a new strategy (Python) and edit it further to customize.
Hi I have tried the code but the error is coming :
AttributeError: 'Panel' object has no attribute 'minox_xs' please help and can we change 1m to 15m time frame?
Oh, apologies, that is a typo: try 'minor_xs' instead of 'minox_xs'. For multiple timeframe, please check out this sample strategy (for Python). We will introduce this to the no-code interface in future release.