using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.Modular; using Frontend.Indicators; using Icarus.Optimiser.Core.Modular; namespace Icarus.Optimiser.Modules { public class IchimokuCrossoverAboveCloudModule : Module { private IchimokuKinkoHyo m_IchimokuKinkoHyo; public void Start( [ModuleParameter(Min = 1, Max = 200, DefaultValue = 9)] int ichimokuTenkanSenPeriods, [ModuleParameter(Min = 1, Max = 200, DefaultValue = 26)] int ichimokuKijunSenPeriods, [ModuleParameter(Min = 1, Max = 200, DefaultValue = 52)] int ichimokuSenkouSpanBPeriods) { m_IchimokuKinkoHyo = Indicators.IchimokuKinkoHyo(ichimokuTenkanSenPeriods, ichimokuKijunSenPeriods, ichimokuSenkouSpanBPeriods); } public ProcessResult Process() { var thisTenkanSen = m_IchimokuKinkoHyo.TenkanSen.Last(1); var lastTenkanSen = m_IchimokuKinkoHyo.TenkanSen.Last(2); var thisKijunSen = m_IchimokuKinkoHyo.KijunSen.Last(1); var lastKijunSen = m_IchimokuKinkoHyo.KijunSen.Last(2); var thisSenkouSpanA = m_IchimokuKinkoHyo.SenkouSpanA.Last(1); var thisSenkouSpanB = m_IchimokuKinkoHyo.SenkouSpanB.Last(1); return new ProcessResult { // If tenkan sen crosses kijun sen from below and the cross was below the kumo cloud (span a and b) then its a long trade EnterLong = lastTenkanSen <= lastKijunSen && thisTenkanSen > thisKijunSen && thisTenkanSen > thisSenkouSpanA && thisTenkanSen > thisSenkouSpanB, EnterShort = lastTenkanSen >= lastKijunSen && thisTenkanSen < thisKijunSen && thisTenkanSen < thisSenkouSpanA && thisTenkanSen < thisSenkouSpanB }; } } }