|
本帖最後由 wisdom1023 於 18-6-6 17:06 編輯
請教如何寫副圖畫線觸價寫法
這樣編寫都沒有買賣訊號出現....不知道是哪寫錯誤....
概念是ADX副圖畫兩條線,觸價24 建新倉,達到 34 平倉
指標: 用ADX
inputs: Length( 14 ) ;
variables: var0( 0 ),var1(24 ),var2( 34) ;
var0 = ADX( Length ) ;
value1 = Plot1;
value2 = Plot2;
value3 = Plot3;
Plot1(var0,"ADX");
Plot2(var1,"UP");
Plot3(var2,"DOWN");
condition1 = var0 > var0[1] and var0[1] <= var0[2] ;
if condition1 then
Alert( "Indicator turning up" )
else
begin
condition1 = var0 < var0[1] and var0[1] >= var0[2] ;
if condition1
then
Alert( "Indicator turning down" ) ;
end
訊號:以SAR趨勢做進場出場
inputs:AfStep( 0.02), AfLimit( 0.2 );
variables: var0(0),var1(0),var2(0),var3(0);
Value1 = ParabolicSAR( AfStep, AfLimit, var0, var1, var2, var3 ) ;
if marketposition=0 and var2=1 and (value1 cross over value2) of data2 then begin
buy("B") next bar at market;
end;
if marketposition=0 and var2=-1 and (value1 cross over value2)of data2 then begin
sellshort("S") next bar at market;
end;
if marketposition <> 0 and (value1 cross over value3) of data2 then begin
sell("SB") next bar at market;
buytocover("SP") next bar at market;
end;
|
|