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. php系统无法上传图片问题

    PHP Warning:  File upload error - unable to create a temporary file in Unknown on line 0   我的测试环境是 w ...

  2. 深入分析Java Web开发

    Web请求过程 如何发起请求:browser,httpclient http解析:chrome ,cache Dns域名解析:域名缓存 cdn:负载,动态加速,回源 Java I/O I/0类库的基本 ...

  3. Centos7安装Docker 基于Dockerfile 搭建httpd运行环境

    Centos7安装Docker 基于Dockerfile 搭建httpd运行环境 docker docker搭建 docker build 本文档完成目标内容如下 使用Docker搭建http服务器一 ...

  4. linux安装gcc-c++

    首先查看系统是否安装: gcc -v    g++ -v    c++ -v 没有安装则执行一键安装命令:#yum install gcc-c++ 如果直接执行:#yum install c++是安装 ...

  5. 淘淘商城_day01_课堂笔记

    今日大纲 聊聊电商行业 电商行业发展 11.11 2015双11: 2016年: 预测:2017年的双11交易额将达到:1400亿 电商行业技术特点 淘淘商城简介 淘淘商城的前身 电商行业的概念 B2 ...

  6. children

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> </head> ...

  7. 常用类型转换 一.常用int和string类型转换

    常用类型转换 一.常用int类型转换1. int.parse(string) 这个类型只支持string类型 2.double doubleType = Int32.MaxValue + 1;   i ...

  8. WEB前端开发中的图片压缩

    web前端开发中,图片的重要性不言而喻,而由于一些图片的大小加上现在国内的网速不给力等种种原因,我们非常有必要对网站使用的图片进行压缩,压缩图片必然会带来图片质量的损失,我们要尽可能的在质量降低很小的 ...

  9. offsetWidth,offsetHeight到底该如何理解?

    1.对象的可见宽度(对象指body.div等) 2.offsetWidth可以返回div的宽 3.offsetWidth=width+padding+border(不包括margin外边距) 4.返回 ...

  10. oracle动态视图v$,v_$,gv$,gv_$与x$之间的关系

    前言:在oracle运维的过程中,经常会使用到一些以V$开头的动态视图,比如V$session, 有一次偶然看到有人用V_$session, 初以为别人写错了,没想到desc v_$session以后 ...