using System;
using System.Drawing;
using PowerLanguage.Function;
using System.Collections; namespace PowerLanguage.Indicator
{
//[SameAsSymbol(true)]
public class Mov_Avg_1_Line : IndicatorObject
{ //1小时 24 1小时 120 private IPlotObject h1_24;
private IPlotObject h1_120;
private IPlotObject h4_120;
private IPlotObject d1_10; ArrayList h1_list = null ;
ArrayList h4_list = null ;
ArrayList d1_list = null ; public Mov_Avg_1_Line(object ctx) :
base(ctx){ } protected override void Create(){ h1_list = new ArrayList();
h4_list = new ArrayList();
d1_list = new ArrayList(); h1_24 =
AddPlot(new PlotAttributes("Avg", , Color.Yellow,
Color.Empty, , , true)); h1_120 =
AddPlot(new PlotAttributes("Avg", , Color.Cyan,
Color.Empty, , , true)); h4_120 =
AddPlot(new PlotAttributes("Avg", , Color.Red,
Color.Empty, , , true)); d1_10 =
AddPlot(new PlotAttributes("Avg", , Color.Red,
Color.Empty, , , true)); } protected override void StartCalc(){ h1_list.Clear();
h4_list.Clear();
d1_list.Clear(); }
int lasthavecal = ;
protected override void CalcBar(){ DateTime dt = Bars.Time[]; int currentbars = dt.Day*+ dt.Hour* + dt.Minute ; if(lasthavecal == currentbars) return ; lasthavecal = currentbars ; cal_h1();
cal_h4();
cal_d1(); } private void cal_h1(){ DateTime dt = Bars.Time[];
DateTime lastdt = Bars.Time[]; int currentx = dt.Day*+ dt.Hour;
int lastx = lastdt.Day*+ lastdt.Hour; if(currentx != lastx)
h1_list.Add(Bars.Close[]); Double value_h1 = MyAvg.Avg(h1_list,);
if(value_h1 > )
h1_24.Set(value_h1); Double value_h1_120 = MyAvg.Avg(h1_list,);
if(value_h1_120 > ){ h1_120.Set(value_h1_120);
} } private void cal_h4(){ DateTime dt = Bars.Time[];
DateTime lastdt = Bars.Time[]; int currentx = dt.Day*+ dt.Hour;
int lastx = lastdt.Day*+ lastdt.Hour; if(currentx != lastx && (dt.Hour== || dt.Hour== || dt.Hour== || dt.Hour== || dt.Hour== || dt.Hour==))
h4_list.Add(Bars.Close[]); Double value_h4_120 = MyAvg.Avg(h4_list,);
if(value_h4_120 > ){ h4_120.Set(value_h4_120);
} } int current_d1 = ;
private void cal_d1(){ DateTime dt = Bars.Time[];
DateTime lastdt = Bars.Time[]; int currentx = dt.Day;
int lastx = lastdt.Day; if(current_d1 != dt.Day)
{
d1_list.Add(Bars.Close[]); current_d1 = dt.Day;
}else{
//干掉 最后一条 d1_list.RemoveAt(d1_list.Count-);
d1_list.Add(Bars.Close[]); List //Output.WriteLine(" currend1= "+current_d1+" day=>"+dt.Day); Double value_d1_10 = MyAvg.Avg(d1_list,);
if(value_d1_10 > ){ d1_10.Set(value_d1_10);
} } }
}

MC 跨周期 画线的更多相关文章

  1. 画线缩放、瞳距缩放、Line延长到指定长度,内附效果,源码供应,解压就跑

    前言 公司项目需要做个画线缩放,我司称之为瞳距缩放,简而言之就是:2张图,从第一张图画一条线,再从第二个图画一条线,第二条线以第一条为基准,延长到一致的长度,并同比缩放图片:文字太枯燥,请先实例图 例 ...

  2. MFC画线功能总结

    本文仅用于学习交流,商业用途请支持正版!转载请注明:http://www.cnblogs.com/mxbs/p/6216464.html MFC画线功能要点有二:其一,鼠标按下时记录初始位置为线的起始 ...

  3. MFC消息映射机制以及画线功能实现

    ---此仅供用于学习交流,切勿用于商业用途,转载请注明http://www.cnblogs.com/mxbs/p/6213404.html. 利用VS2010创建一个单文档标准MFC工程,工程名为Dr ...

  4. CGContextRef 画线简单用法

    CGContextRef CGContextMoveToPoint(context,150,50);//圆弧的起始点 CGContextAddArcToPoint(context,100,80,130 ...

  5. Android中Path类的lineTo方法和quadTo方法画线的区别

    转载:http://blog.csdn.net/stevenhu_223/article/details/9229337 当我们需要在屏幕上形成画线时,Path类的应用是必不可少的,而Path类的li ...

  6. C#使用 DirectX SDK 9做视频播放器 并在视频画线添加文字 VMR9

    视频图像处理系列 索引 VS2013下测试通过. 在百度中搜索关键字“DirectX SDk”,或者进入微软官网https://www.microsoft.com/en-us/download/det ...

  7. iOS小画板画线总结

    一:基本画线: 使用贝赛尔曲线画: //创建路径 UIBezierPath* aPath = [UIBezierPath bezierPath]; //设置线宽 aPath.lineWidth = 5 ...

  8. [修复] Firemonkey 画线问题(Android & iOS 平台)

    问题:官方 QC 的一个 Firemonkey 移动平台画线问题: RSP-14309: [iOS & Android] Delphi 10.1 Berlin - drawing proble ...

  9. WPF画线问题,几千条以后就有明显的延迟了。

      我现在是这么画的,class A { private GeometryGroup _lines; private Path _path; public A() {    _path.Data = ...

随机推荐

  1. Petya and Spiders【二进制状压】

    题目链接[http://codeforces.com/problemset/problem/111/C] 题意:给出大小为N*M的图(1 ≤ n, m ≤ 40, n·m ≤ 40),每个图中有一个蜘 ...

  2. [Rails] 从 Request 到 Response(1)

    本文翻译自:Rails from Request to Response 系列:个人选择了自己感兴趣的部分进行翻译,需要阅读原文的同学请戳前面的链接. 第一部分 导言(Introduction) 服务 ...

  3. log4j配置示例

    在配置文件中按包名或类名来定义Logger 在程序中按类名取Logger 定义: log4j.rootLogger=debug,stdout log4j.logger.com.mypkg=debug, ...

  4. openstack私有云布署实践【13.2 网络Neutron-compute节点配置(办公网环境)】

    所有compute节点 下载安装组件   # yum install openstack-neutron openstack-neutron-linuxbridge ebtables ipset -y ...

  5. 淘淘商城_day10_课堂笔记

    今日大纲 Dubbo入门学习 使用dubbo优化单点登录系统 系统间服务调用方式 浏览器直接访问 浏览器发起请求,通过ajax或jsonp方式请求: Httpclient方式 系统与系统之间通过Htt ...

  6. PAT 团体程序设计天梯赛-练习集 L1-005. 考试座位号

    每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位.正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座 ...

  7. 认识<meta>

    概要:在查看网页源码的时候,经常发现有<meta>标签存在,于是查了一下它的作用,发现有很多功能.下面就简单的阐述一些常见的功能. 一[什么是<meta>标签] meta,即m ...

  8. EasyuiAPI:菜单

    一.LinkButton(按钮) 1.通过标签创建: <a id="btn" href="#" class="easyui-linkbutton ...

  9. jquery操作属性 attr()和 prop()兼容性问题

    jquery1.6中新加了一个方法prop(),一直没用过它,官方解释只有一句话:获取在匹配的元素集中的第一个元素的属性值. 大家都知道有的浏览器只要写disabled,checked就可以了,而有的 ...

  10. HUST 1404 Hamming Distance(字符串)

    Hamming Distance Description Have you ever heard of the Hamming distance. It is the number of positi ...