qei10R20aUPjj2mbe73Ddg

rhaNUzBP.JpbGSGnl1SgBw

以上的兩圖是比較 Mod-HA Paint Bar Study 的不同,上圖在HTS裡可以找到code,而下圖是在TradeStation的support center裡KAHUNA所改寫的.
可以顯見的,KAHUNA多了個警告訊號的黃色,我自己還沒認真看過HTS的user quide所以還沒能改寫成適合HTS的code,日後有空再試試.....
以下貼上KAHUNA的ModHA2 Paint Bar的code和兩個內含的function......有TS2000的同好可以運用.有誰改寫成STRATEGY的記得分享一下
{ ModHA2 Paint Bar Study 4/10/04
Determines HA Colors for two (Min/Max) number of Compare bars and displays the Up Color (UpColor) if they aggree in the Up direction,displays the Down Color (DnColor) if they aggree in the Down direction, and displays the Warning Color if they do not agree. ............KAHUNA }
Inputs:
UpColor(green),
DnColor(red),
WarnColor(yellow),
MinCompBars(6),
MaxCompBars(20),
nPlotWidth(2);
Vars:
haClose(0),haOpen(0),haMinDir(0),haMaxDir(0),Color(0);
{ Get HA Direction for Min/Max Compare Bars }
haMinDir = fModHAKahuna(MinCompBars, haOpen, haClose);
haMaxDir = fModHAKahuna(MaxCompBars, haOpen, haClose);

{ Load Display Color }
if haMinDir = 1 and haMaxDir = 1 then
begin
Color = UpColor;

end;
if haMinDir = 2 and haMaxDir = 2 then
begin
Color = DnColor;
end;

if haMinDir <> haMaxDir then
begin
Color = WarnColor;
end;
{ Paint Bar }
PlotPB(haOpen,haClose, "ModHA2", Color);
SetPlotWidth(1,nPlotWidth);
SetPlotColor(1,color);
-------------------------------------------------------------------------------------
FUNCTION:fModHAKahuna
{ ModHAValue Function - 4/10/04
compares current bar open to close range
with prior bars...if current is within
prior then Up/Down value remains the same}
Inputs:
CompBars(numericsimple),
oOpenVal(numericref), {Output: HA Open Price}
oCloseVal(numericref) {Output: HA Close Price};
Vars:
haClose(0),
haOpen(0),
haHigh(0),
haLow(0),
Index(0),
UpVal(1), {Constant: Up haDir value}
DownVal(2), {Constant: Down haDir value}
Return(0);
if BarNumber = 1 then
begin
haOpen = open;
haClose = (O+H+L+C)/4;
haHigh = MaxList( high, haOpen, haClose);
haLow = MinList( low, haOpen, haClose);
end
else {BarNumber > 1 }
begin
haClose = (O+H+L+C)/4;
haOpen = (haOpen[1] + haClose[1])/2 ;
haHigh = MaxList(High, haOpen, haClose) ;
haLow = MinList(Low, haOpen, haClose) ;

if haClose > haOpen then
Return = UpVal
else
Return = DownVal;

for Index = 1 to CompBars
begin
if haOpen <= MaxList(haOpen[Index],haClose[Index]) and
haOpen >= MinList(haOpen[Index],haClose[Index]) and
haClose <= MaxList(haOpen[Index],haClose[Index]) and
haClose >= MinList(haOpen[Index],haClose[Index]) then
Return = Return[Index];
end;
end;
{Load Output Values}
oOpenVal = haOpen;
oCloseVal = haClose;
fModHAKahuna = Return;
----------------------------------------------------------------------------------

Heiken-Ashi K線蠟燭圖能夠濾掉噪聲,即濾去匯價的短期波動,使你能更清楚的看清匯價的主要趨勢 。

H-A 也是一種均線技術,因此屬於滯後技術指標。

當今天的蠟燭為紅色,表示匯價上漲,可以買入;如果今天的蠟燭是綠色,表示下跌,可以賣出。如果同一種顏色的蠟燭持續幾天,就可以獲利。

基本算法:

HaClose = (open+high+low+close)/4;
HaOpen = (ref(Open,1)+Open)/2;
HaHigh = Max(high, Max(HaClose, HaOpen));
HaLow = Min(low,Min(HaClose, HaOpen));

實際算法比上述復雜。

5 simple rules for modified candle and they can be easily remembered:
理解燭圖更叠的意義時須記住以下五個簡單原則:

Rule 1 : Positive candle means “BUY” (Basic Rule) Negative candle means “SELL”
1.陽燭圖表示“買”(約定的基本原則),陰燭圖表示“賣”。

Rule 2 : Positive candle with upper shadow means “strong BUY” Negative candle with lower shadow means “strong SELL”
2.帶上影的陽燭圖表示“強勢買”,帶下影的陰燭圖表示“強勢賣”。

Rule 3 : Positive candle with lower shadow means “weak BUY” Negative candle with upper shadow means “weak SELL”
3. 帶下影的陽燭圖表示“弱勢買”,帶上影的陰燭圖表示“弱勢賣”。

Rule 4 : Candle shorter than previous day means “an indication of a Change”.
4.燭圖長度短於前一期時意味著“即將轉勢”。

Rule 5 : Very short candle (especially cross-shaped) means “a Change of the trend”.
5.燭圖長度很短時(特別是十字星出現時)意味著“趨勢翻轉”。
arrow
arrow
    全站熱搜

    David 發表在 痞客邦 留言(0) 人氣()