版主,能不能幫忙看下,關于跟蹤止盈中最高價的傳遞問題 [開拓者 TB]
- 咨詢內容:
SetGlobalVar(0,High);
SetGlobalVar(1,Low);
If(MarketPosition==1 and BarsSinceEntry>0)
HiAfterEntry=GetGlobalVar(0);
HiAfterEntry=Max(HiAfterEntry,High);
If(MarketPosition==-1 and BarsSinceEntry>0)
loafterentry=GetGlobalVar(1);
LoAfterEntry=Min(LoAfterEntry,Low);
Commentary("HiAfterEntry="+Text(HiAfterEntry));
Commentary("LoAfterEntry="+Text(LoAfterEntry));
不知道哪里出問題,最高價最低價根本傳遞不起來 - TB技術人員:
傳遞的一直都是當前最高價或當前最低價
- TB客服:
If(MarketPosition==1 and BarsSinceEntry==0)
HiAfterEntry=High;
If(MarketPosition==1 and BarsSinceEntry>=1)
HiAfterEntry=Max(HiAfterEntry,High);
If(MarketPosition==-1 and BarsSinceEntry==1)
LoAfterEntry=Low[1];
If(MarketPosition==-1 and BarsSinceEntry>1)
LoAfterEntry=Min(LoAfterEntry,Low);
Commentary("HiAfterEntry="+Text(HiAfterEntry));
Commentary("LoAfterEntry="+Text(LoAfterEntry));
這個是我當時的另一種傳遞的寫法,也失敗了 - 網友回復:
youyu8792 發表于 2012-6-4 14:22
If(MarketPosition==1 and BarsSinceEntry==0)
HiAfterEntry=High;
If(MarketPosition==1 and BarsSinceEnt ...
試試以下代碼
聲明兩個序列數值型變量,HiAfterEntry和LoAfterEntry。- if(buycondition)
- {
- buy();
- HiAfterEntry= high;
- }else
- {
- HiAfterEntry = max(HiAfterEntry[1],high);
- }
- ....
- if(sellcondition)
- {
- sellshort();
- LoAfterEntry = low;
- }else
- {
- LoAfterEntry = min(LoAfterEntry[1],low);
- }
- if(buycondition)
- 網友回復:
謝謝,測試中,后來有用幫助里的例子,也算是成功了,但有個問題,這種傳遞在實盤中需要使用全局變量來弄嗎
如果以上指標公式不適用于您常用的行情軟件
或者您想改編成選股公式,以便快速選出某種形態個股的話,
相關文章
-
沒有相關內容