MC 跨周期 画线
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 跨周期 画线的更多相关文章
- 画线缩放、瞳距缩放、Line延长到指定长度,内附效果,源码供应,解压就跑
前言 公司项目需要做个画线缩放,我司称之为瞳距缩放,简而言之就是:2张图,从第一张图画一条线,再从第二个图画一条线,第二条线以第一条为基准,延长到一致的长度,并同比缩放图片:文字太枯燥,请先实例图 例 ...
- MFC画线功能总结
本文仅用于学习交流,商业用途请支持正版!转载请注明:http://www.cnblogs.com/mxbs/p/6216464.html MFC画线功能要点有二:其一,鼠标按下时记录初始位置为线的起始 ...
- MFC消息映射机制以及画线功能实现
---此仅供用于学习交流,切勿用于商业用途,转载请注明http://www.cnblogs.com/mxbs/p/6213404.html. 利用VS2010创建一个单文档标准MFC工程,工程名为Dr ...
- CGContextRef 画线简单用法
CGContextRef CGContextMoveToPoint(context,150,50);//圆弧的起始点 CGContextAddArcToPoint(context,100,80,130 ...
- Android中Path类的lineTo方法和quadTo方法画线的区别
转载:http://blog.csdn.net/stevenhu_223/article/details/9229337 当我们需要在屏幕上形成画线时,Path类的应用是必不可少的,而Path类的li ...
- C#使用 DirectX SDK 9做视频播放器 并在视频画线添加文字 VMR9
视频图像处理系列 索引 VS2013下测试通过. 在百度中搜索关键字“DirectX SDk”,或者进入微软官网https://www.microsoft.com/en-us/download/det ...
- iOS小画板画线总结
一:基本画线: 使用贝赛尔曲线画: //创建路径 UIBezierPath* aPath = [UIBezierPath bezierPath]; //设置线宽 aPath.lineWidth = 5 ...
- [修复] Firemonkey 画线问题(Android & iOS 平台)
问题:官方 QC 的一个 Firemonkey 移动平台画线问题: RSP-14309: [iOS & Android] Delphi 10.1 Berlin - drawing proble ...
- WPF画线问题,几千条以后就有明显的延迟了。
我现在是这么画的,class A { private GeometryGroup _lines; private Path _path; public A() { _path.Data = ...
随机推荐
- Python 第二课笔记
1.模块初识 Python标准库和第三方库, 写好的功能封装好,起个名字,就是模块也叫库,直接导入就能用了. 标准库就是不需要安装,就能够导入的库 第三方库必须下载,安装才能使用的库. 1.1 两个标 ...
- Linux下SVN的简单配置
1.安装svn sudo yum install subversion 2.查看是否安装成功 svnserve --version 3.创建svn目录 svnadmin create 目录名 例如:s ...
- 不使用jquery情况下循环添加绑定事件方法
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 关于ASCII,Unicode和UTF-8
自己也不是很明白这些编码,百度了一下,整理出来与大家分享分享,在此感谢作者. 先说说这些编码 ANSI:最早的时候计算机ASCII码只能表示256个符号(含控制符号),这个字符集表示英文字母足够,其中 ...
- L3-004. 肿瘤诊断
L3-004. 肿瘤诊断 题目链接:https://www.patest.cn/contests/gplt/L3-004 BFS 之前尝试使用递归dfs,提交后发现有两个段错误,发现递归层数太多,然后 ...
- 关于requirejs中的define的原理理解
我们已经了解到模块模式是为单例创建私有变量和特权方法的. 一个最基本的例子: var foo=(function(){ var something='cool', var another=[1,2,3 ...
- Linux入门(三)搭建服务器linux运行环境LAMP/LNMP
本文内容主要根据慕课网教学视频整理,原链接http://www.imooc.com/learn/170 我用的linux系统是ubuntu 12.04 LTS 虚拟机是VMware Workstat ...
- hdu和poj的基础dp30道
题目转自:https://crazyac.wordpress.com/dp%E4%B8%93%E8%BE%91/ 1.hdu 1864 最大报销额 唔,用网上的算法连自己的数据都没过,hdu的数据居然 ...
- React 相关资料
learncodeacademy/react-js-tutorials MobX
- Spring入门学习(二)三种实例化bean的方法
前面的哪一种就是通过构造函数来实例化对象 下面我们可能用到工厂方法来视力话对象,这样我们的配置文件又该怎么配置呢 <bean name="service2" class=&q ...