senkou span a and b gives same vaues??
senkou span a and b gives same vaues??
25 Feb 2020, 00:13
Senkou span A and senkou span b values are always same in my program, I couldnt fix the problem. How can i have true values of senkou span a and b?
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SampleSARTrailingStop : Robot
{
//Ichimoku Settings - NOT BE BE CHANGED UNLESS YOU KNOW WHAT YOU ARE DOING
[Parameter(DefaultValue = 9)]
private int tenkansen { get; set; }
[Parameter(DefaultValue = 26)]
private int kijunsen { get; set; }
[Parameter(DefaultValue = 52)]
private int senb { get; set; }
public IndicatorDataSeries SenkouSpanB { get; set; }
public IndicatorDataSeries SenkouSpanA { get; set; }
IchimokuKinkoHyo ichimoku;
protected override void OnStart()
{
ichimoku = Indicators.IchimokuKinkoHyo(tenkansen, kijunsen, senb);
}
protected override void OnBar()
{
var index = Bars.ClosePrices.Count;
if (ichimoku.SenkouSpanB[index - 26] > Symbol.Ask && ichimoku.SenkouSpanB[index - 26] > Symbol.Ask)
{
ExecuteMarketOrder(TradeType.Sell, Symbol.Name, 10000, "sat");
}
else if (ichimoku.SenkouSpanA[index - 26] < Symbol.Ask && ichimoku.SenkouSpanA[index - 26] < Symbol.Ask)
{
{
ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 10000, "al");
Print("SenkouSpanA Value = {0}", ichimoku.SenkouSpanA[index - 26]);
Print("SenkouSpanB Value = {0}", ichimoku.SenkouSpanB[index - 26]);
Print("ChikouSpan Value = {0}", ichimoku.ChikouSpan.LastValue);
Print("KijunSen Value = {0}", ichimoku.KijunSen.LastValue);
}
}
}
}
}
Replies
barancansahin88
25 Feb 2020, 09:38
( Updated at: 21 Dec 2023, 09:21 )
RE:
Thank you for answer, but SenkouSpan A and B values are same at every bar. They are supposed to have different values to create kumo cloud.
PanagiotisCharalampous said:
Hi barancansahin88,
I cannot reproduce the problem. The values change on every bar, see below.
Best Regards,
Panagiotis
@barancansahin88
srubtsov
26 Feb 2020, 12:11
RE:
barancansahin88 said:
Senkou span A and senkou span b values are always same in my program, I couldnt fix the problem. How can i have true values of senkou span a and b?
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SampleSARTrailingStop : Robot
{
//Ichimoku Settings - NOT BE BE CHANGED UNLESS YOU KNOW WHAT YOU ARE DOING
[Parameter(DefaultValue = 9)]
private int tenkansen { get; set; }
[Parameter(DefaultValue = 26)]
private int kijunsen { get; set; }
[Parameter(DefaultValue = 52)]
private int senb { get; set; }
public IndicatorDataSeries SenkouSpanB { get; set; }
public IndicatorDataSeries SenkouSpanA { get; set; }
IchimokuKinkoHyo ichimoku;
protected override void OnStart()
{
ichimoku = Indicators.IchimokuKinkoHyo(tenkansen, kijunsen, senb);
}
protected override void OnBar()
{
var index = Bars.ClosePrices.Count;
if (ichimoku.SenkouSpanB[index - 26] > Symbol.Ask && ichimoku.SenkouSpanB[index - 26] > Symbol.Ask)
{
ExecuteMarketOrder(TradeType.Sell, Symbol.Name, 10000, "sat");
}
else if (ichimoku.SenkouSpanA[index - 26] < Symbol.Ask && ichimoku.SenkouSpanA[index - 26] < Symbol.Ask)
{
{
ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 10000, "al");
Print("SenkouSpanA Value = {0}", ichimoku.SenkouSpanA[index - 26]);
Print("SenkouSpanB Value = {0}", ichimoku.SenkouSpanB[index - 26]);
Print("ChikouSpan Value = {0}", ichimoku.ChikouSpan.LastValue);
Print("KijunSen Value = {0}", ichimoku.KijunSen.LastValue);
}
}
}
}
}
The problem is in private properties. Parameters can't be with `private` access modifier, it should be with `public`. So default value isn't applied to properties and they all contain zero value.
@srubtsov
PanagiotisCharalampous
25 Feb 2020, 08:44
Hi barancansahin88,
I cannot reproduce the problem. The values change on every bar, see below.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous