可以請教各位高手multicharts程式寫法的問題...
各位高手好,小弟剛開始學著寫multicharts程式有一個問題
不知道如何寫,拜求高手們指導
想法如下
Inputs:FAST(30),SLOW(60);
vars:OK(0);
if Time=0850 then begin
OK=OPEND(0);
FAST=Average(close,FAST);
SLOW=Average(close,SLOW);
end;
//===============Long/Short======================
if OK>FAST and OK>SLOW then goto ==A== ;
if OK<FAST and OK<SLOW then goto ==B== ;
//===============A======================
if marketposition=0 then
buy("Entry_B") next bar market;
if marketposition>0 and close crosses under Average(close,FAST) then
sell("EXIT_B") next bar at market;
goto ==trading End ==
//===============B======================
if marketposition=0 then
sellshort("Entry_S") next bar market;
if marketposition<0 and close crosses above Average(close,SLOW) then
buytocover ("EXIT_S") next bar at market;
goto ==trading End ==
//=================trading End ========================
if time>=1325 then begin
sell next bar at market;
buytocover next bar at market;
end;
請教紅字的部份應該怎麼寫才對?
圖示可能較清楚
先謝謝大家~~ 本帖最後由 TrendRover 於 11-11-28 05:41 AM 編輯
不知這樣如何?
........................................................
~~~~~~~~~~~~~~~~~~~~~~~~
vars:Direction(0),OrderSendFinish(0);
While OrderFinish= 0 Begin
//===============Long/Short======================
if OK>FAST and OK>SLOW then Direction =1 ;
if OK<FAST and OK<SLOW then Direction=-1 ;
//===============A======================
if marketposition=0and Direction =1 then
buy("Entry_B") next bar market; //add OrderSendFinish=1 here
if marketposition>0 and close crosses under Average(close,FAST)and Direction=1 then
sell("EXIT_B") next bar at market;//add OrderSendFinish=1 here
while OrderSendFinish =1 Begin //開始天下大亂了!!
//===============B======================
if marketposition=0 And Direction =-1 then
sellshort("Entry_S") next bar market;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...........
.................................. 本帖最後由 TrendRover 於 11-11-28 05:41 AM 編輯
你安排的goto end自己類推:
不要用 fortran BASIC 的老東西把自己綁死!!!
你會很難活,因為goto 早該進博物館冰起來. 回復 1# dracula0911
你是DRC/LPE的programmer嗎? dracula 是cadence tool for DRC ?
0911不要亂取 ,USA很敏感. 讓我想起了打孔卡的年代很不好玩的年代計算機CDCXXXX
頁:
[1]