 |
brandon
初級會員
註冊日期: Jul 2008
來 自:
文章數量: 18 |
交易指標問題求救
請教版主......我想設計一個21ma向上翻揚時進多單.......直至向下彎時出多單並進空單.......直至下次再次向上翻揚時出空單並進多單........
多進:= ma(c,21)>ref(ma(c,21),1) and ref(ma(c,21),1)<=ref(ma(c,21),2) ;
多出:= ma(c,21)<ref(ma(c,21),1) and ref(ma(c,21),1)>=ref(ma(c,21),2) ;
空進:= ma(c,21)<ref(ma(c,21),1) and ref(ma(c,21),1)>=ref(ma(c,21),2) ;
空出:= ma(c,21)>ref(ma(c,21),1) and ref(ma(c,21),1)<=ref(ma(c,21),2) ;
這面是我寫的.......問題來了......我要如何過濾掉多單或空單尚未出場前.....如果又出現一次多進或空進的訊號時不進場......部位永遠維持一個多單或一個空單而已.......麻煩請版主幫忙解惑.......感恩......謝謝
|
|
向版主報告此篇 |  |
|
2017-10-13 15:43 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18145 |
回覆: 交易指標問題求救
引用: 最初由 brandon 發表
請教版主......我想設計一個21ma向上翻揚時進多單.......直至向下彎時出多單並進空單.......直至下次再次向上翻揚時出空單並進多單........
多進:= ma(c,21)>ref(ma(c,21),1) and ref(ma(c,21),1)<=ref(ma(c,21),2) ;
多出:= ma(c,21)<ref(ma(c,21),1) and ref(ma(c,21),1)>=ref(ma(c,21),2) ;
空進:= ma(c,21)<ref(ma(c,21),1) and ref(ma(c,21),1)>=ref(ma(c,21),2) ;
空出:= ma(c,21)>ref(ma(c,21),1) and ref(ma(c,21),1)<=ref(ma(c,21),2) ;
這面是我寫的.......問題來了......我要如何過濾掉多單或空單尚未出場前.....如果又出現一次多進或空進的訊號時不進場......部位永遠維持一個多單或一個空單而已.......麻煩請版主幫忙解惑.......感恩......謝謝
MA21:ma(c,21);
MA21R1:=ref(MA21,1);
MA21R2:=ref(MA21,2);
多進:= MA21>MA21R1 and MA21R1<=MA21R2 or barpos=0;
多出:= MA21<MA21R1 and MA21R1>=MA21R2 or barpos=0;
空進:= MA21<MA21R1 and MA21R1>=MA21R2 or barpos=0;
空出:= MA21>MA21R1 and MA21R1<=MA21R2 or barpos=0;
CK:=多進-多出;
CK:=ref(CK,barslast(CK<>0));
CK:=if(CK<>ref(CK,1) or barpos=lbound(CK),CK,0);
多進:=CK=1; 多出:=CK=-1;
CK:=空進-空出;
CK:=ref(CK,barslast(CK<>0));
CK:=if(CK<>ref(CK,1) or barpos=lbound(CK),CK,0);
空進:=CK=1; 空出:=CK=-1;
|
|
向版主報告此篇 |  |
|
2017-10-13 16:53 |
|
|
|  |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|