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 = ...
随机推荐
- Gradle学习草稿
参考博客:http://www.cnblogs.com/davenkin/p/gradle-learning-1.html Android Plugin DSL Reference http://go ...
- hive-1.2.1安装步骤
一.Hive安装和配置 1.先决条件 已经安装好hadoop-2.4.1,hbase-1.0.0. 2.下载Hive安装包 当前Hive可到apache官网下载,选择的是hive-1.2.1.运行: ...
- KVM设置DHCP、DNS、Gateway
添加网卡 sudo vi /etc/network/interfaces #添加下面的配置 >>>>>>>> auto tap0 iface tap0 ...
- Nginx将项目配置在子目录
问题:一个完整的项目需要整合在另外一个项目中,作为一个子模块存在 有两个项目prject1 根目录/www/project1与project2 /www/project2,现在是想将probject1 ...
- ubuntu 把终端信息输出到文本文件中的方法
方法一:把终端中所有信息都写到文本文件中 在终端的命令行中输入以下命令: $ script -f output.txt 这样就会在当前目录下创建一个output.txt文件 接下来,在按 ...
- js数组、对象、正则
1.根据给定的条件在原有的数组上,得到所需要的新数组var a = [-1, -1, 1, 2, -2, -2, -3, -3, 3, -3];function f(s, e) { var re ...
- JavaScript input框输入实时校验
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- ios 软键盘顶起这个页面
html { overflow: hidden; } ;;;; } ;;; } ;; left: 200px; overflow: auto;} 行内的滚动条.
- linux下安装php的mcrypt拓展
安装步骤: 1,#wget http://museum.php.net/php5/php-5.3.3.tar.gz 2,解压:#tar -zxvf php-5.3.3.tar.gz 3,#cd ...
- JUit——(三)JUnit核心对象(测试、测试类、Suit和Runner)
JUnit的核心对象:测试.测试类.测试集(Suite).测试运行器 1. 测试: @Test注释的.公共的.不带有任何参数.并且返回void类型的方法 2. 测试类: 公共的,包含对应类的测试方法的 ...