MC 在1分钟图拿出5分钟,15分钟,30分钟,1小时的K线

时间:2023-03-09 08:46:28
MC 在1分钟图拿出5分钟,15分钟,30分钟,1小时的K线
using System;
using System.Drawing;
using System.Linq;
using System.Collections; namespace PowerLanguage
{
namespace Function
{
public class OtherFrame
{ DateTime d;double o=; double h=; double l=;double c=; ArrayList listm5 = null;
ArrayList listm15 = null;
ArrayList listm30=null;
ArrayList listh1 = null;
public OtherFrame()
{ listm5 = new ArrayList();
listm15 = new ArrayList(); listm30 = new ArrayList();
listh1 = new ArrayList(); } public void setBarsData(DateTime d, double o, double h, double l, double c)
{
this.c = c;
this.o = o;
this.h = h;
this.l = l;
this.d = d;
calM30();
calH1();
calM15();
calm5();
} public ArrayList getm5list()
{
return listm5; }
public ArrayList getm15list()
{ return listm15; } public ArrayList getm30list()
{
return listm30; } public ArrayList getH1list()
{ return listh1; } int lasthour = -; double temp_open_h1 = ;
double temp_high_h1 = ;
double temp_low_h1 = ; ///小时线的算法
void calH1()
{ if (lasthour != d.Hour && d.Minute > )
{ temp_high_h1 = h;
temp_low_h1 = l; temp_open_h1 = o;
OLHC olhc = new OLHC();
olhc.close = c;
olhc.open = temp_open_h1;
olhc.high = temp_high_h1;
olhc.low = temp_low_h1; if (listh1.Count == ) listh1.Add(olhc);
else listh1.Insert(, olhc); lasthour = d.Hour;
}
else
{ if (temp_high_h1 == || h > temp_high_h1) temp_high_h1 = h;
if (temp_low_h1 == || l < temp_low_h1) temp_low_h1 = l;
if (listh1.Count > )
{ OLHC olhc = (OLHC)listh1[];
olhc.close = c;
olhc.high = temp_high_h1;
olhc.low = temp_low_h1;
listh1[] = olhc; } } } int last30min = -; double temp_open_m30 = ;
double temp_high_m30 = ;
double temp_low_m30 = ; void calM30()
{ int willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= || d.Minute == ) willlast = ; if (willlast != last30min)
{
temp_high_m30 = h;
temp_low_m30 = l; temp_open_m30 = o;
OLHC olhc = new OLHC();
olhc.close = c;
olhc.open = temp_open_m30;
olhc.high = temp_high_m30;
olhc.low = temp_low_m30;
if (listm30.Count == ) listm30.Add(olhc);
else listm30.Insert(, olhc); last30min = willlast; }
else
{
if (temp_high_m30 == || h > temp_high_m30) temp_high_m30 = h;
if (temp_low_m30 == || l < temp_low_m30) temp_low_m30 = l;
if (listm30.Count > )
{ OLHC olhc = (OLHC)listm30[];
olhc.close = c;
olhc.high = temp_high_m30;
olhc.low = temp_low_m30;
listm30[] = olhc; } } } //--------------------------------------------- int last15min = -; double temp_open_m15 = ;
double temp_high_m15 = ;
double temp_low_m15 = ;
void calM15()
{ int willlast = ;
if (d.Minute >= && d.Minute <= ){ willlast = ;}
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= || d.Minute == ) willlast = ; //HTTP.write("C:\\mc\\e.xxx",d+" "+ last15min +" "+willlast+" "+"\r\n"); if (willlast != last15min)
{
temp_high_m15 = h;
temp_low_m15 = l; temp_open_m15 = o;
OLHC olhc = new OLHC();
olhc.close = c;
olhc.open = temp_open_m15;
olhc.high = temp_high_m15;
olhc.low = temp_low_m15;
if (listm15.Count == ) listm15.Add(olhc);
else listm15.Insert(, olhc); last15min = willlast; }
else
{
if (temp_high_m15 == || h > temp_high_m15) temp_high_m15 = h;
if (temp_low_m15 == || l < temp_low_m15) temp_low_m15 = l;
if (listm15.Count > )
{ OLHC olhc = (OLHC)listm15[];
olhc.close = c;
olhc.high = temp_high_m15;
olhc.low = temp_low_m15;
listm15[] = olhc; } } } //-------------------------------- int last5min = -; double temp_open_m5 = ;
double temp_high_m5 = ;
double temp_low_m5 = ;
void calm5()
{ int willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= && d.Minute <= ) willlast = ;
if (d.Minute >= || d.Minute == ) willlast = ; if (willlast != last5min)
{
temp_high_m5 = h;
temp_low_m5 = l; temp_open_m5 = o;
OLHC olhc = new OLHC();
olhc.close = c;
olhc.open = temp_open_m5;
olhc.high = temp_high_m5;
olhc.low = temp_low_m5;
if (listm5.Count == ) listm5.Add(olhc);
else listm5.Insert(, olhc); last5min = willlast; }
else
{
if (temp_high_m5 == || h > temp_high_m5) temp_high_m5 = h;
if (temp_low_m5 == || l < temp_low_m5) temp_low_m5 = l;
if (listm5.Count > )
{ OLHC olhc = (OLHC)listm5[];
olhc.close = c;
olhc.high = temp_high_m5;
olhc.low = temp_low_m5;
listm5[] = olhc; } } } //-------------------------------- }
}
}