The Indicator data look like is diffirent
The Indicator data look like is diffirent
15 Apr 2018, 19:26
namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class CS : Indicator { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } [Output("柱高低点", Color = Colors.Red)] public IndicatorDataSeries Result_HL { get; set; } [Output("分型", Color = Colors.Yellow)] public IndicatorDataSeries Result_Pt { get; set; } [Output("有效分型")] public IndicatorDataSeries Result_PtV { get; set; } public CZSC C; public List<BarInfo> BarInfos; private List<double> Ld; protected override void Initialize() { C = new CZSC(MarketSeries, Result_HL, Result_Pt, Result_PtV); } public override void Calculate(int index) { C.Calculates(index, out BarInfos, out Ld); string b; if (this.Ld[index] == double.NaN) { b = ""; } else { b = Ld[index].ToString(); } ChartObjects.DrawText(index.ToString(), Result_Pt[index].ToString(), index, Result_Pt[index], VerticalAlignment.Center, HorizontalAlignment.Center, Colors.BlueViolet); // Print(MarketSeries.OpenTime[index].ToString() + " L: " + Result_Pt[index] + "-" + Ld[index]); } } }
the yellow Indicator line and the ChartObjects.DrawText is all from the Result_Pt【IndicatorDataSeries 】,But the value of ChartObjects.DrawText() is diffirent form the value of IndicatorDataSeries line.
why ???
Replies
Bits
17 Apr 2018, 07:05
( Updated at: 21 Dec 2023, 09:20 )
RE:
Panagiotis Charalampous said:
Hi yearn2012,
We cannot see how you calculate Result_Pt. Therefore we cannot advise. If you wish, please post the complete code so that we can reproduce and provide an explanation.
Best Regards,
Panagiotis
Panagiotis,GOOD MOONING
IN this pictrue, i watch in vs debugger, the indicator value of Results[1506] is NAN,the value of BarInfos[1056].trend is null,and this bar is the time of 2018-4-16 12:10. this is the Screenshots while the index is 1600,so i am sure than the value of 1056th will be not calculated in after time.
public class BarInfo { public double High; public double Low; public int Index; public BarTrend Trend; } List<BarInfo> BarInfos;
in below pictrue,in the chart, Results[1506] is NAN value,is right, but the value of BarInfos[1056] is UP not null value of watch list in the time of 2018-4-16 12:10.
the c# code is blowe:
string s = ""; s = C.BarInfos[index].Trend.ToString(); ChartObjects.DrawText(index.ToString(), s, index, Result[index] + 0.005, VerticalAlignment.Center, HorizontalAlignment.Center, Colors.White);
what wrong ,i donot find it, it
@Bits
PanagiotisCharalampous
17 Apr 2018, 09:56
Hi yearn2012,
As I mentioned above, I need the complete indicator source code in order to help you.
Best Regards,
Panagiotis
@PanagiotisCharalampous
Bits
17 Apr 2018, 10:49
( Updated at: 21 Dec 2023, 09:20 )
RE:
Panagiotis Charalampous said:
Hi yearn2012,
As I mentioned above, I need the complete indicator source code in order to help you.
Best Regards,
Panagiotis
the main wrong execute code:
/// LastBarInfo.Index<index is true !
if ((MarketSeries.High[index] - MarketSeries.Low[index]) >= (LastBarInfo.High - LastBarInfo.Low))
{
BarTemp = new BarInfo { High = double.NaN, Low = double.NaN, Trend = BarTrend.Con, Index = LastBarInfo.Index };
BarInfos.Remove(LastBarInfo);
BarInfos.Insert(LastBarInfo.Index, BarTemp);
BarInfos[LastContainIndex] = new BarInfo { High = 0, Low = 0, Trend = BarTrend.Con, Index = LastBarInfo.Index };
}
My email is 157683719@qq.com,you can send your Email Address to me ,so i can send my soures code.
And I find the same simple code execute wrong!
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; //using Me.Indicator; using System.Collections.Generic; using Me.Indicator; namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class CS : Indicator { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } [Output("分型", Color = Colors.Yellow)] public IndicatorDataSeries Result { get; set; } public List<BarInfo> BarInfos { get; set; } protected override void Initialize() { BarInfos = new List<BarInfo>(); } public override void Calculate(int index) { BarInfos.Add(new BarInfo { High = MarketSeries.High[index], Low = MarketSeries.Low[index], Index = index, Trend = BarTrend.Up }); if (index % 5 == 0) { BarInfos.RemoveAt(index); BarInfos.Insert(index, new BarInfo { High = MarketSeries.High[index], Low = MarketSeries.Low[index], Index = -index, Trend = BarTrend.Con }); } BarInfo k = BarInfos[index]; ///////// if ((BarTrend)k.Trend == BarTrend.Con) { ChartObjects.DrawText(index.ToString(), k.Index.ToString(), index, MarketSeries.High[index], VerticalAlignment.Center, HorizontalAlignment.Center, Colors.Blue); } ///////// ChartObjects.DrawText(index.ToString(), k.Index.ToString(), index, MarketSeries.High[index] + 0.3, VerticalAlignment.Center, HorizontalAlignment.Center, Colors.Azure); Result[index] = BarInfos[index].High; Print(index.ToString() + " L:" + BarInfos[index].Trend.ToString()); } } public enum BarTrend { Up = 1, Down = -1, Con = 0 } public class BarInfo { public double High; public double Low; public int Index; public BarTrend Trend; } }
The code between the "//////" cannot execute rightly, the " if((BarTrend)k.Trend == BarTrend.Con) { ...} "cannot running in,
the screenshots show below:
@Bits
... Deleted by UFO ...
PanagiotisCharalampous
17 Apr 2018, 17:48
Hi yearn2012,
You can send your code at community@spotware.com. Please also try to put a description of what your indicator is supposed to do, what would you expect to see and what you are seeing instead. This will help us help you.
Best Regards,
Panagiotis
@PanagiotisCharalampous
Bits
18 Apr 2018, 04:56
( Updated at: 21 Dec 2023, 09:20 )
RE:
Panagiotis Charalampous said:
Hi yearn2012,
You can send your code at community@spotware.com. Please also try to put a description of what your indicator is supposed to do, what would you expect to see and what you are seeing instead. This will help us help you.
Best Regards,
Panagiotis
Panagiotis :
I have saved the source code file to the Email community@spotware.com.
[Output("分型", Color = Colors.Yellow)] public IndicatorDataSeries Result { get; set; } public override void Calculate(int index) { C.Calculates(index); ChartObjects.DrawText(index.ToString(), Result[index].ToString(), index, C.BarInfos[index].High); }
@Bits
PanagiotisCharalampous
16 Apr 2018, 11:20
Hi yearn2012,
We cannot see how you calculate Result_Pt. Therefore we cannot advise. If you wish, please post the complete code so that we can reproduce and provide an explanation.
Best Regards,
Panagiotis
@PanagiotisCharalampous