![]() |
在這個頁面顯示本主題全部的 5 個文章 |
奇狐社區論壇 (http://www.chiefox.com.tw/bbs/index.php)
- 問題交流 (http://www.chiefox.com.tw/bbs/forumdisplay.php?forumid=28)
-- [問題]兩個問題(獲利點數顯示+策略變換) (http://www.chiefox.com.tw/bbs/showthread.php?threadid=16081)
[問題]兩個問題(獲利點數顯示+策略變換)
想請問版主
1.請問有辦法在K線圖中的策略出場點下方顯示從進場到出場共賺(賠)多少點嗎???
用DRAWTEXT畫不出來
2.請問若我想在A,B兩不同進出場策略之間做替換
替換規則為
先執行A策略(包含多進,多出,空進,空出)
當A策略連續虧損兩次 停用A策略
改用B策略(包含多進,多出,空進,空出)
當B策略連續虧損兩次 停用B策略 改用A策略
如此循環 該怎麼寫呢
謝謝版主
回覆: [問題]兩個問題(獲利點數顯示+策略變換)
引用:
最初由 ZHACK 發表
想請問版主
1.請問有辦法在K線圖中的策略出場點下方顯示從進場到出場共賺(賠)多少點嗎???
用DRAWTEXT畫不出來
謝謝版主
回覆: [問題]兩個問題(獲利點數顯示+策略變換)
引用:
最初由 ZHACK 發表
想請問版主
2.請問若我想在A,B兩不同進出場策略之間做替換
替換規則為
先執行A策略(包含多進,多出,空進,空出)
當A策略連續虧損兩次 停用A策略
改用B策略(包含多進,多出,空進,空出)
當B策略連續虧損兩次 停用B策略 改用A策略
如此循環 該怎麼寫呢
謝謝版主
DoBS 值意義:原碼:
m1:ma(c,5); m2:ma(c,20);
m3:ma(c,10); m4:ma(c,30);
進A:=cross(m1,m2) or barpos=0;
出A:=cross(m2,m1) or barpos=0;
進B:=cross(m3,m4) or barpos=0;
出B:=cross(m4,m3) or barpos=0;
UMode:=0; //值: 0.策略A, 1.策略B
NowBS:=0; 進價:=0; XCount:=0;
CC:=Close; DoBS:C*0 NOAXIS;
for i=1 to datacount do begin
if UMode=0 then begin
//策略A
if 進A[i] and NowBS=0 then begin
NowBS:=1; 進價:=CC[i]; DoBS[i]:=1;
end else if 出A[i] and NowBS=1 then begin
NowBS:=0; DoBS[i]:=2;
if CC[i]-進價<0 then begin
XCount:=XCount+1;
if XCount=2 then begin
XCount:=0; UMode:=1;
end;
end else begin
XCount:=0;
end;
end;
end else begin
//策略B
if 進B[i] and NowBS=0 then begin
NowBS:=1; 進價:=CC[i]; DoBS[i]:=3;
end else if 出B[i] and NowBS=1 then begin
NowBS:=0; DoBS[i]:=4;
if CC[i]-進價<0 then begin
XCount:=XCount+1;
if XCount=2 then begin
XCount:=0; UMode:=0;
end;
end else begin
XCount:=0;
end;
end;
end;
end;
回覆: 回覆: [問題]兩個問題(獲利點數顯示+策略變換)
引用:
最初由 cgjj 發表
參考範例:
DoBS 值意義:原碼:
m1:ma(c,5); m2:ma(c,20);
m3:ma(c,10); m4:ma(c,30);
進A:=cross(m1,m2) or barpos=0;
出A:=cross(m2,m1) or barpos=0;
進B:=cross(m3,m4) or barpos=0;
出B:=cross(m4,m3) or barpos=0;
UMode:=0; //值: 0.策略A, 1.策略B
NowBS:=0; 進價:=0; XCount:=0;
CC:=Close; DoBS:C*0 NOAXIS;
for i=1 to datacount do begin
if UMode=0 then begin
//策略A
if 進A[i] and NowBS=0 then begin
NowBS:=1; 進價:=CC[i]; DoBS[i]:=1;
end else if 出A[i] and NowBS=1 then begin
NowBS:=0; DoBS[i]:=2;
if CC[i]-進價<0 then begin
XCount:=XCount+1;
if XCount=2 then begin
XCount:=0; UMode:=1;
end;
end else begin
XCount:=0;
end;
end;
end else begin
//策略B
if 進B[i] and NowBS=0 then begin
NowBS:=1; 進價:=CC[i]; DoBS[i]:=3;
end else if 出B[i] and NowBS=1 then begin
NowBS:=0; DoBS[i]:=4;
if CC[i]-進價<0 then begin
XCount:=XCount+1;
if XCount=2 then begin
XCount:=0; UMode:=0;
end;
end else begin
XCount:=0;
end;
end;
end;
end;
回覆: 回覆: 回覆: [問題]兩個問題(獲利點數顯示+策略變換)
引用:
最初由 ZHACK 發表
若A策略多空進出場策略均不同
請問要怎麼將A策略寫進去?
想要將下方語法加進版主的A,B策略中
THX
進L:=進多A or barpos=0;
出L:=出多A or barpos=0;
進S:=進空A or barpos=0;
出S:=出空A or barpos=0;
NowLS:=0; //1.多, -1.空, 0.無
DOLS:=C*0;
Do進:=進L-進S; Do出:=出L-出S;
...........................
全部時間均為台灣時間, 現在時間為06:36 | 在這個頁面顯示本主題全部的 5 個文章 |
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved.