Hi.

Is there any way to consider the ichimoku clouds (kumo) that are projected into the future to enter a trade using building blocks?

For exemple:

1
286
Solved
10 Replies

Bookmark

Sort
I don't see a direct way to get those values, but you can calculate them easily. Here's how I did it (code below) -

1. Drag the Ichimoku into a chart
2. Right click and "Push Dropped Indicators"
3. Add the code as indicated below. Also declare the private TimeSeries ssA, ssB references.

Now you can refer to the projected cloud values on the current index.

```CODE:using WealthLab.IchimokuCloud;
using WealthLab.Backtest;
using System;
using WealthLab.Core;
using WealthLab.Indicators;
using System.Collections.Generic;

namespace WealthScript123
{
public class MyStrategy : UserStrategyBase
{
//create indicators and other objects here, this is executed prior to the main trading loop
public override void Initialize(BarHistory bars)
{
ind5 = new ChikouSpan(bars,26);
PlotIndicator(ind5, WLColor.FromArgb(255,132,121,199), PlotStyle.Line);
ind4 = new SenkouSpanB(bars,52,26);
PlotIndicator(ind4, WLColor.FromArgb(255,219,80,80), PlotStyle.Cloud);
ind3 = new TenkanSen(bars,9);
PlotIndicator(ind3, WLColor.FromArgb(255,120,120,255), PlotStyle.Line);
ind2 = new KijunSen(bars,26);
PlotIndicator(ind2, WLColor.FromArgb(255,255,40,40), PlotStyle.Line);
ind1 = new SenkouSpanA(bars,9,26,26);
PlotIndicator(ind1, WLColor.FromArgb(255,60,160,60), PlotStyle.Cloud);

ssB = (Highest.Series(bars.High, 52) + Lowest.Series(bars.Low, 52)) / 2d;
ssA = (ind3 + ind2) / 2d;

int n = bars.Count - 1 ;
WriteToDebugLog("Future SenkouSpanA at last bar " + ssA[n]);
WriteToDebugLog("Future SenkouSpanB at last bar " + ssB[n]);
}

//execute the strategy rules here, this is executed once for each bar in the backtest history
public override void Execute(BarHistory bars, int idx)
{
if (!HasOpenPosition(bars, PositionType.Long))
{
}
else
{
}
}

//declare private variables below
private IndicatorBase ind1;
private IndicatorBase ind2;
private IndicatorBase ind3;
private IndicatorBase ind4;
private IndicatorBase ind5;
private TimeSeries ssA;
private TimeSeries ssB;
}
}
```
2
Understood. Thanks Cone.

Based on this, I believe it's possible to create two custom indicators to be used with building blocks, am I right?
0
Ah, you were asking about Building Blocks. Hmmm, you can use MathIndOpInd to add the two indicators together, but then you need to divide by 2.

This needs keeps coming up. We need a MathIndOpIndOpValue. Let's think about that one.
1
Right.

I understand that the code is not that difficult to implement.
However, the building blocks give us a lot of agility to change trading system conditions in an extremely easy way.
0
WL8 has an undervalued tool: "New Custom Indicator (C#)". I believe that it's suitable for this job. Indicators created with this tool can then be used in Blocks, too.
2
Totally agree Eugene. I will try to use it.
0
I also helped Emilio set up an indicator library in Visual Studio. Once the custom indicator is developed and working, add it to your compiled library for even better performance.
3
Your concierge service it's pretty good, by the way.

This part I must learn how to do yet haha.

As soon as I am able to use my personal computer, I will try to create the indicator and figure out how to compile it.
3
I think it's working!

Now it's time to try putting it in the same library as Glitch mentioned.

Updated: Already did put in the same library too.

Thank you very much to you all!
2
👍
0