程式碼大約如下:
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