COCO研究院

 找回密碼
 註冊
搜索
查看: 3635|回復: 5

請問是否有直接平倉的語法?

[複製鏈接]
發表於 15-11-13 16:00 | 顯示全部樓層 |閱讀模式
請問各位大大

       如何在30分k(或其他k線中)作多或作空下,語法能下在一天後或二天後的=開盤=直接平倉,因為作多或空的時間點不一定,
無法用算數量的方式,是否有指令可以設定?感恩

發表於 15-11-13 16:17 | 顯示全部樓層
只聽過 模擬收盤平倉 的指令

發表於 15-11-13 18:21 | 顯示全部樓層
inputs:exitday(2);



if marketposition <>0 then begin
        if date-entrydate(0)>=exitday then begin
                if time>1344 then begin
                        sell next bar at market;                       buytocover next bar at market;
                end;
        end;
end;

~~~~~~~~~~~~~~~~~
exitday:0-進場後隔天開盤就出掉
exitday:1-進場後1天隔天開盤就出掉
exitday:2-進場後2天隔天開盤就出掉
依此類推

不知道是不是您要的


發表於 15-11-13 19:06 | 顯示全部樓層
本帖最後由 pcking2008 於 15-11-13 19:09 編輯
blj0511 發表於 15-11-13 18:21
inputs:exitday(2);

date-entrydate(0)

進場是周五, 兩個交易日後出場, 下一天周一, 這公式就..
10月31號進場, 下一天是 11月1號, 相減至少....

恐怕要每日計數+1來判斷第幾天
發表於 15-11-13 19:33 | 顯示全部樓層
pcking2008 發表於 15-11-13 19:06
date-entrydate(0)

進場是周五, 兩個交易日後出場, 下一天周一, 這公式就..

一語驚醒夢中人~~~~ 就要改成這樣

inputs:exitday(2);
var:daycounter(-1);


if daycounter>=0 and date>date[1] then begin;
        daycounter=daycounter+1;
end;

if marketposition<>0 and entrydate=date then begin
        daycounter=0;
end;

if marketposition=0 then begin
        daycounter=-1;
end;


if marketposition <>0 then begin
        if daycounter>=exitday then begin
                if time>1344 then begin
                        sell next bar at market;
                        buytocover next bar at market;
                end;
        end;
end;

評分

參與人數 1金錢 +1 收起 理由
pcking2008 + 1 太熱心了

查看全部評分

 樓主| 發表於 15-11-13 21:21 | 顯示全部樓層
感謝各位大大的指導!感恩
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-4-28 05:53

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook