设为首页收藏本站

 找回密码
 注册
查看: 3200|回复: 4
打印 上一主题 下一主题

请问 老师 TS的可以用于TB吗 可以帮忙把这改成TB 的吗?? [复制链接]

Rank: 2

精华
0
UID
5394
积分
101
帖子
32
主题
8
阅读权限
30
注册时间
2009-9-7
最后登录
2010-9-5
跳转到指定楼层
1#
发表于 2010-4-12 16:32:56 |只看该作者 |倒序浏览
LegacyColorValue = true];

{ ======================================
This is my implementation of some aspects of Murrey Math. It is based on coded posted at Amibroker by Peter Gialames,
who based it on the Excel spreadsheet by Jacek. You are welcome to use this code freely.  You may redistribute it
provided you include this comment block, plus a description of any changes you make.

If you extend it, or adapt it to other uses, I'd appreciate a look at what you've done.

     Thanks.

     James R. Rehler
  
     THANKS James, crack king
  
3/08/07 ver. 2.0d - Alpha distribution

========================================}

{
USAGE
}

Input: Frame(8), Multpier(20), BodyHiLo(False),Display_MMLevels(false),Display_MMValues(true),Display_MMFrame(false),debug(False);
Vars: D6(0.00000001), FHigh(H), FLow(L), HH(H), Increment(0), LL(L), MN(0), MX(999999), OCT(1), PriceRange(1), SF(0.0000), Span(1);
Vars:StrtVal(0), MMLDelete(0);
Vars: MML(-1), Count(0), TLrt(0), TLlt(0), TLc(1), TLstyle(1);
Arrays: mVal[13](0), mTxtVal[13](0), mColor[13](1), ML_Ref[13](0),m8th[13]("");
vars:tester(1),d66(0),d11(0),d12(0),d13(0),d14(0),d15(0),d16(0),d18(0), E11(0), E12(0),E13(0),E14(0),E15(0),E16(0), E18(0);
vars: DoInit(True);
vars:  NumDec(2),        {Number of decimal spaces to use on post}
          Color(white);     {Color of text that is posted.          }
vars: HH_save(0),LL_save(0);

If BodyHiLo then HH = Highest(MaxList(O, C), Frame*Multpier)
    else HH = Highest(H, Frame*Multpier);
If BodyHiLo then LL = Lowest(MinList(O, C), Frame*Multpier)
    else LL = Lowest(L, Frame*Multpier);

{ change to update on every tick
so skip if hh/ll has not changed & update lines every tick
update mmlines if HH or LL has changed }

{if HH <> HH_save or LL <> LL_save then begin}
   
PriceRange=HH-LL;

if debug = True then print("HH = ", HH);
if debug = True then print("LL = ", LL);
if debug = True then print("PriceRange = ", PriceRange:0:4 );

{Indentify Scale Factor}
If HH <= 250000 and HH > 25000 then SF = 100000
    else if HH <= 25000 and HH > 2500 then SF = 10000
    else if HH <= 2500 and HH > 250 then SF = 1000
    else if HH <= 250 and HH > 25 then SF = 100
    else if HH <= 12.5 and HH > 6.25 then SF = 12.5
    else if HH <= 6.25 and HH > 3.125 then SF = 6.25
    else if HH <= 3.125 and HH > 1.5625 then SF = 3.125
    else if HH <= 1.5625 and HH > 0.390625 then SF = 1.5625
    else SF = 0.1953125;

D6 =  intportion(Log10(SF/PriceRange)/Log10(2));
OCT = SF * (Power(0.50, D6));

if debug = True then print("SF = ", SF:0:4 );
if debug = True then print("D6 = ", D6:0:4 );
if debug = True then print("OCTAVE = ", OCT:0:4 );

MN = IntPortion (LL/OCT);
if debug = True then print("MN = ", MN:0:4 );
MN = MN * OCT; { trunc occurs before the mult, this forces that}

If (MN + OCT) > HH then MX = MN + OCT
    else MX = MN + (2 * OCT);

if debug = True then print("MX = ", MX:0:4 );
if debug = True then print("MN = ", MN:0:4 );

Span=MX-MN;

if LL >= 0.1875 * Span + MN AND HH <= 0.5625 * Span + MN then D12 = MN + 0.50 * Span else D12 =0;
if LL >= 0.4375 * Span + MN AND HH <= 0.8125 * Span + MN then D14 = MN + 0.75 * Span else D14 =0;
if LL >= MN - 0.125  * Span AND HH <= 0.625  * Span + MN AND D12 = 0 then D11 = MN + 0.50 * Span else D11 =0;
if LL >= 0.375  * Span + MN AND HH <= 1.125  * Span + MN AND D14 = 0 then D15 = MX else D15 =0;
if LL >= 0.125  * Span + MN AND HH <= 0.875  * Span + MN AND D11= 0 AND D12 = 0 AND D14 =0 AND D15 = 0 then D13 = MN + 0.75 * Span else D13 =0;
if D11+D12+D13+D14+D15 = 0 then D16 = MX else D16 = 0;

     if D11 > 0 then D18 = D11
else if D12 > 0 then D18 = D12
else if D13 > 0 then D18 = D13
else if D14 > 0 then D18 = D14
else if D15 > 0 then D18 = D15
else if D16 > 0 then D18 = D16;     { added this line }
   
FHigh = D18;

if debug = True then print("D11 = ", D11:0:4 );
if debug = True then print("D12 = ", D12:0:4 );
if debug = True then print("D13 = ", D13:0:4 );
if debug = True then print("D14 = ", D14:0:4 );
if debug = True then print("D15 = ", D15:0:4 );
if debug = True then print("D16 = ", D16:0:4 );
if debug = True then print("D18 = ", D18:0:4 );


if debug = True then print("Span = ", Span:0:4 );
if debug = True then print("FHigh = ", FHigh:0:4 );

if D11 > 0 then E11 = MN else E11 = 0;
if D12 > 0 then E12 = MN  + 0.25 * Span else E12 = 0;
if D13 > 0 then E13 = MN  + 0.25 * Span else E13 = 0;
if D14 > 0 then E14 = MN  + 0.50 * Span else E14 = 0;
if D15 > 0 then E15 = MN  + 0.50 * Span else E15 = 0;
if D16 > 0 then E16 = MN else E16 = 0;
E18 = E11+E12+E13+E14+E15+E16;
FLOW = e18;

if debug = True then print("E11 = ", E11:0:4 );
if debug = True then print("E12 = ", E12:0:4 );
if debug = True then print("E13 = ", E13:0:4 );
if debug = True then print("E14 = ", E14:0:4 );
if debug = True then print("E15 = ", E15:0:4 );
if debug = True then print("E16 = ", E16:0:4 );
if debug = True then print("E18 = ", E18:0:4 );

if debug = True then print("FLow = ", FLow:0:4);

Increment=0.125*(FHigh-FLow);

Value11=FLow-Increment;
StrtVal=Value11-Increment;
Value0=FLow;
Value1=FLow+Increment;
Value2=Value1+Increment;
Value3=Value2+Increment;
Value4=Value3+Increment;
Value5=Value4+Increment;
Value6=Value5+Increment;
Value7=Value6+Increment;
Value8=FHigh;
Value9=Value8+Increment;
Value10=Value9+Increment;

if highest(h,5) > value7 and c < l[1] and time > 0845 and time < 1445 then alert("change mode short");
if lowest(l,5) < value1 and c > h[1] and time > 0845 and time < 1445 then alert("change mode long");

if debug = True then print(Strtval:0:4 );
if debug = True then print(value11:0:4 );
if debug = True then print(value0:0:4 );
if debug = True then print(value1:0:4 );
if debug = True then print(value2:0:4 );
if debug = True then print(value3:0:4 );
if debug = True then print(value4:0:4 );
if debug = True then print(value5:0:4 );
if debug = True then print(value6:0:4 );
if debug = True then print(value7:0:4 );
if debug = True then print(value8:0:4 );
if debug = True then print(value9:0:4 );
if debug = True then print(value10:0:4 );


mColor[0]=Tool_darkRed;
mColor[1]=Tool_darkYellow;
mColor[2]=Tool_darkBlue;
mColor[3]=Tool_darkYellow;
mColor[4]=Tool_darkRed;
mColor[5]=Tool_darkGreen;
mColor[6]=Tool_darkBlue;
mColor[7]=Tool_darkGreen;
mColor[8]=Tool_darkRed;
mColor[9]=Tool_darkYellow;
mColor[10]=Tool_darkBlue;
mColor[11]=Tool_darkYellow;
mColor[12]=Tool_darkRed;

mVal[0]=Tool_Dotted;
mVal[1]=Tool_Dotted;
mVal[2]=Tool_Solid;
mVal[3]=Tool_Dotted;
mVal[4]=Tool_Dotted;
mVal[5]=Tool_Dotted;
mVal[6]=Tool_Dotted;
mVal[7]=Tool_Dotted;
mVal[8]=Tool_Dotted;
mVal[9]=Tool_Dotted;
mVal[10]=Tool_Solid;
mVal[11]=Tool_Dotted;
mVal[12]=Tool_Dotted;

m8th[0]= " -2/8 ";
m8th[1]= " -1/8 ";
m8th[2]= " 0/8  ";
m8th[3]= " 1/8  ";
m8th[4]= " 2/8  ";
m8th[5]= " 3/8  ";
m8th[6]= " 4/8  ";
m8th[7]= " 5/8  ";
m8th[8]= " 6/8  ";
m8th[9]= " 7/8  ";
m8th[10]=" 8/8  ";
m8th[11]="+1/8 ";
m8th[12]="+2/8 ";

{
If CurrentBar>=Frame+1 then begin   
    For Count = 0 to 12 begin
        MMLDelete=TL_Delete(ML_Ref[Count]);
    end;
end;
}
{**** Intialize ML & Text Arrays ****}
If DoInit then begin
    For Count = 0 to 12 begin
        
        value19 = StrtVal + Count*Increment;
        ML_Ref[Count]=TL_New(Date[1], Time[1], value19, Date, Time, value19);
        
        mTxtVal[Count]=Text_New(D,Time,C,m8th[Count]+ "Intialize Array");
        Text_SetStyle(mTxtVal[Count], 0, 2);
        Text_SetColor(mTxtVal[Count],color);

    end;
    DoInit=False;

end;

If LastBarOnChart then begin   
        For Count = 0 to 12 begin
        TL_Delete(ML_Ref[Count]);
        value19 = StrtVal + Count*Increment;
        ML_Ref[Count]=TL_New(Date[1], Time[1], value19, Date, Time, value19);
        TLstyle=TL_SetStyle(ML_Ref[Count], mVal[count]);
        TLrt=TL_SetExtRight(ML_Ref[Count], true);
        TLlt=TL_SetExtLeft(ML_Ref[Count], true);
        TLc=TL_SetColor(ML_Ref[Count], mColor[count]);

    if Display_MMValues = True OR Display_MMLevels = True then begin
    if DataCompression    > 0
        then Value20=AddTime(T,BarInterval)
        else Value20=AddTime(T,2);
          Text_SetLocation(mTxtVal[Count],D,Value20+2,value19);
        if Display_MMValues = True AND     Display_MMLevels = True then Text_SetString(mTxtVal[Count], ""+m8th[Count]+NumToStr(value19, numdec))
        else if Display_MMValues = True AND    Display_MMLevels = False then Text_SetString(mTxtVal[Count], ""+NumToStr(value19, numdec))
        else if Display_MMValues = False AND Display_MMLevels = True then Text_SetString(mTxtVal[Count], ""+m8th[Count]);
       end;
    end;

HH_save = HH;
LL_save = LL;


{These two plots force the frame display but mmlines may get squashed if range is small}
if Display_MMFrame = True
    then begin
    Plot1(StrtVal - Increment );
    Plot2(Value10 + Increment );
    end
    else begin
    NoPlot(1);
    NoPlot(2);
    end;

end;




{end;} {end check of prior HH/LL }

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20906
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
2#
发表于 2010-4-12 16:54:26 |只看该作者
请你用汉字表述清楚,实现起来更方便快捷

使用道具 举报

Rank: 2

精华
0
UID
5394
积分
101
帖子
32
主题
8
阅读权限
30
注册时间
2009-9-7
最后登录
2010-9-5
3#
发表于 2010-4-12 17:06:50 |只看该作者
原帖由 lh948 于 2010-4-12 16:54 发表
请你用汉字表述清楚,实现起来更方便快捷

我只知道这个是现代江恩理论的典型应用 .具体的汉字表述我不清楚哦.....应该很复杂....

使用道具 举报

Rank: 5Rank: 5

精华
0
UID
5940
积分
1179
帖子
285
主题
28
阅读权限
60
注册时间
2009-11-21
最后登录
2015-1-19
4#
发表于 2010-4-14 22:35:08 |只看该作者
还是用中文吧  以前觉得TS很简单,被你1弄,没信心了
海豚

使用道具 举报

Rank: 2

精华
0
UID
5394
积分
101
帖子
32
主题
8
阅读权限
30
注册时间
2009-9-7
最后登录
2010-9-5
5#
发表于 2010-4-24 16:58:06 |只看该作者
???版主 可以帮忙 解决这问题吗 我可是帮你们在期货公司  说了不少好话的哦..

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-24 02:50

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部