Wealth-lab ApplyAutoStop訊號輸出成檔案? - 財經

Table of Contents


程式碼大約如下:

InstallProfitTarget( 18 );
InstallStopLoss(2); //2% stop

for Bar := daysMA to BarCount - 1 do
begin
ApplyAutoStops( Bar +1 );
....
if LastPositionActive then
begin
if ... then
begin
CoverAtMarket(Bar+1, LastPosition, 'Cover');
FileWrite(FileCreate('C:\signal.txt'),LastPosition+'1'); //1 buy
end;
end
else
if ... then
begin
ShortAtMarket(Bar+1, 'Short+'+AsString(WaitToExit));
FileWrite(FileCreate('C:\signal.txt'),LastPosition+'-1'); //-1 sell
end;
end;
end;

正常情況下
short跟cover訊號都可以寫入signal.txt
下單機也可以正常讀取signal.txt

但是碰到stoploss時
卻沒有辦法把cover的訊號寫到signal.txt
就會有open的部位

請問要如何把AutoStop的訊號輸出到signal.txt呢?
或是要如何將autostop修改成manual cover的程式碼?

謝謝

--

All Comments

Candice avatarCandice2008-11-23
我之前是用自已寫的stoploss去解決~~XD
Edith avatarEdith2008-11-25
不過我也很想知道其它的方法~~~~
Hedy avatarHedy2008-11-30
我覺得ApplyAutoStops那邊怪怪的 你無法look-ahead
Jacob avatarJacob2008-12-04
說明書寫當你在scan某日時 只要某日有觸發條件 就會啟
動.. 但是Bar+1尚未發生 無法觸發..請參考
David avatarDavid2008-12-06
說明書上也寫 autostop是某Bar結束後去檢查的