終於找到一個 windows live 套件, 可以順利在 Pixnet Blog 貼程式碼.
而且, 不用擔心程式碼有多長, 利用捲軸功能, 不會讓版面落落長.

這個套件是 : Code Snippet plugin for Windows Live Writer.
下載網址 : http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748&pl=8&bt=9

推薦給有使用 Pixnet 的格主.

試貼的程式碼簡介:(網路上抓來的)

Murrey Maths for Tradestation , 莫瑞數字密碼是現代江恩理論的典型應用.
研究江恩, 原作很重要, 但新江恩派在美國更具有吸引力.
以下是基於 TS 的原代碼.


[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 elseD13 =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 thenText_SetString(mTxtVal[Count], ""+m8th[Count]+NumToStr(value19, numdec))
else if Display_MMValues = True AND Display_MMLevels = Falsethen 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;


ps. 不虧是號稱 10個世界最頂級的指標之一.
程式碼還真長, 讓我沒什麼信心去看完它~

arrow
arrow
    全站熱搜

    htnvt241 發表在 痞客邦 留言(1) 人氣()