sytseng6532
發表於 19-10-5 16:06
新手新手請多多指教,謝謝大大的分享 讓我多學一種出場方式
frostcarter
發表於 20-4-22 19:31
學到新的出場方法,感謝
daniel888
發表於 21-8-5 14:46
謝謝大大的分享,
新手,有需要多參考各種的方法,多試一些出場方法
qeagle
發表於 22-7-20 23:09
大家好,我想把這個寫成一個指標疊加在價位上。
因為沒有下單指令,所以就虛擬一個初始...但一直不成功,想請教高手那裏出了問題???
inputs:
len_latern(25),
len_atr(50),
coef(2);
vars:
cond5(False),
cond6(False),
call_stop(H),
put_stop(L),
Pos_H(0),
Pos_L(0),
var1(0),
var2(0),
status(0);
if CurrentBar = 1 then
begin
Pos_H = H ;
Pos_L = L ;
status = 0;
// call_stop = Pos_H - 100;
// put_stop = Pos_L + 100;
end ;
if status = 1 and H > Pos_H then// Do the call
Pos_H = H ;
if status = -1 and L < Pos_L then // Do the put
Pos_L = L ;
// call_stop = highest(h,len_latern) - coef * AvgTrueRange(len_atr);// Call stop line
// put_stop = lowest(l,len_latern)+ coef * AvgTrueRange(len_atr);// Put stop line
if currentbar > 100 then
begin
call_stop = Pos_H - coef * AvgTrueRange(len_atr);// Call stop line
put_stop = Pos_L+ coef * AvgTrueRange(len_atr);// Put stop line
end;
ifc cross below call_stop then begin
status = -1;
Pos_L = L ;
end;
ifh cross above put_stop then begin
status = 1;
Pos_H = H ;
end ;
if status = 1 then
plot1(call_stop,"",RED);
// plot4(Pos_H,"",RED);
if status = -1 then
Plot2(put_stop,"",GREEN);
// Plot3(Pos_L,"",GREEN);
qeagle
發表於 22-8-6 06:55
最後有把指標寫出來,給有需要的人參考。
inputs:
len_latern(25),
len_atr(50),
len(50),
coef(2);
vars:
cond5(False),
cond6(False),
call_stop(H),
put_stop(L),
Pos_H(0),
Pos_L(0),
var1(0),
var2(0),
status(0);
if CurrentBar = 100 then
begin
Pos_H = H ;
Pos_L = L ;
status = 0;
// call_stop = Pos_H - 100;
// put_stop = Pos_L + 100;
end ;
if currentbar = 100 then
begin
Pos_H = H ;
call_stop = Pos_H - coef * AvgTrueRange(len);// Call stop line
Pos_L = L ;
put_stop = Pos_L+ coef * AvgTrueRange(len);// Put stop line
end;
if currentbar > 100 then
begin
if status = 1 and H > Pos_H then// Do the call
begin
Pos_H = H ;
call_stop = Pos_H - coef * AvgTrueRange(len);// Call stop line
end;
if status = -1 and L < Pos_L then // Do the put
begin
Pos_L = L ;
put_stop = Pos_L+ coef * AvgTrueRange(len);// Put stop line
end;
// call_stop = highest(h,len_latern) - coef * AvgTrueRange(len_atr);// Call stop line
// put_stop = lowest(l,len_latern)+ coef * AvgTrueRange(len_atr);// Put stop line
ifc cross below call_stop then begin
status = -1;
Pos_L = L ;
put_stop = Pos_L+ coef * AvgTrueRange(len);// Put stop line
end;
ifc cross above put_stop then begin
status = 1;
Pos_H = H ;
call_stop = Pos_H - coef * AvgTrueRange(len);// Call stop line
end ;
end;
if status = 1 then begin
plot1(call_stop,"",RED);
// plot4(Pos_H,"",YELLOW);
end;
if status = -1 then begin
Plot2(put_stop,"",GREEN);
// Plot3(Pos_L,"",BLUE);
end;