Help with Ichimoku
Help with Ichimoku
22 Nov 2017, 03:55
Hello
Im trying to build an algorithm that will trade off of ichimoku
my goal to enter a long position is
enter if price has crossed above cloud and tenkansen > kijun sen and chikou > kumo
but i need the algorigthm to keep scanning until its all conditions are met and its currently not doing so
This is what i have currently
if (MarketSeries.Close.HasCrossedAbove(ichimoku.SenkouSpanA.LastValue, 10)) { if (MarketSeries.Close.HasCrossedAbove(ichimoku.SenkouSpanB.LastValue, 10)) { if (ichimoku.KijunSen.LastValue > ichimoku.TenkanSen.LastValue) { if (ichimoku.ChikouSpan.LastValue > ichimoku.SenkouSpanA.LastValue && ichimoku.ChikouSpan.LastValue > ichimoku.SenkouSpanB.LastValue) { Open(TradeType.Buy); } } } }
Replies
khan_tu
22 Nov 2017, 20:51
RE:
Panagiotis Charalampous said:
Hi khan_tu,
Can you please give us some more information why you say that your algorithm is "currently not doing so"? Is it because it stops executing for any reason? A code sample of a complete cBot would be more helpful to understand what could go wrong.
Best Regards,
Panagiotis
The Problem Seems to be that its not running through the entire nested if statement, it runs through one or two, but doesnt read all of them
it enters positions it shouldnt because one conditin was true but the others werent for some reason
@khan_tu
BeardPower
22 Nov 2017, 21:53
The Problem Seems to be that its not running through the entire nested if statement, it runs through one or two, but doesnt read all of them
it enters positions it shouldnt because one conditin was true but the others werent for some reason
It does, but you have two issues in your code.
enter if price has crossed above cloud and tenkansen > kijun sen and chikou > kumo)
TenkanSen should be > than KijunSen, not the other way round.
if (ichimoku.KijunSen.LastValue > ichimoku.TenkanSen.LastValue)
The correct code is:
if (MarketSeries.Close.HasCrossedAbove(ichimoku.SenkouSpanA.LastValue, 10)) { if (MarketSeries.Close.HasCrossedAbove(ichimoku.SenkouSpanB.LastValue, 10)) { if (ichimoku.TenkanSen.LastValue > ichimoku.KijunSen.LastValue) { if (ichimoku.ChikouSpan.LastValue > ichimoku.SenkouSpanA.LastValue && ichimoku.ChikouSpan.LastValue > ichimoku.SenkouSpanB.LastValue) { Open(TradeType.Buy); } } } }
@BeardPower
BeardPower
22 Nov 2017, 21:55
RE:
Sorry, it was only one issue, but the forum does not support the editing of posts.
@BeardPower
PanagiotisCharalampous
22 Nov 2017, 11:35
Hi khan_tu,
Can you please give us some more information why you say that your algorithm is "currently not doing so"? Is it because it stops executing for any reason? A code sample of a complete cBot would be more helpful to understand what could go wrong.
Best Regards,
Panagiotis
@PanagiotisCharalampous