舒潔 發表於 17-10-4 21:52

三價線程式碼哪裡有誤?

各位大大好~我在網上抄寫下來的新三價線指標程式碼(是用TS寫的)~我是使用Multichsrts~編譯成功卻無法在圖上顯示~哪裡有誤嗎?可否請各位大大抽空看一下呢?謝謝!!

Input:NumBarsBreak(3);
Variables:RunningHigh(0),
          RunningHighLast(0),
          RunningLow(999999),
          RunningLowLast(999999),
          UpLine(FALSE),
          DownLine(FALSE),
          oExtremeVal(0),
          oExtremePosRaw(0);
Array:LastBars[](0);

Once Begin
Array_SetMaxIndex(LastBars,NumBarsBreak);
if C>O then Begin
   For Value2=2 to NumBarsBreak Begin
   LastBars=999999;
   end;
   RunningHigh=C;
   RunningHighLast=O;
   LastBars=O;
   UpLine=TRUE;
   DownLine=FALSE;
end;

If C<O then Begin
   RunningLow=C;
   RunningLowLast=O;
   LastBars=O;
   Upline=FALSE;
   DownLine=TRUE;
end;
end;

If UpLine=TRUE and UpLine then Begin
   Value1=ExtremesArray(LastBars,NumBarsBreak,-1,oExtremeVal,oExtremePosRaw);
   If C>RunningHigh then Begin
      RunningHighLast=RunningHigh;
      RunningHigh=C;
   Value1=_ArrayStepper1Dim(LastBars);
   LastBars=RunningHighlast;
   End;
   If C<oExtremeVal then Begin
      Downline=TRUE;
      Upline=FALSE;
      For Value2=2 to NumBarsBreak Begin
      LastBars=0;
   End;
   LastBars=RunningHighLast;
   RunningLow=C;
   RunningLowLast=RunningHighLast;
End;
End;

If DownLine=TRUE and DownLine=TRUE then Begin
   Value1=ExtremesArray(LastBars,NumBarsBreak,1,oExtremeval,oExtremePosRaw);
   If C<RunningLow then Begin
      RunningLowLast=RunningLow;
      RunningLow=C;
   Value1=_ArrayStepper1Dim(LastBars);
   LastBars=RunningLowLast;
   end;
   If C>oExtremeVal then Begin
      DownLine=FALSE;
      UpLine=TRUE;
      For Value2=2 to NumBarsBreak Begin
      LastBars=999999;
   End;
   LastBars=RunningLowLast;
   RunningHigh=C;
   RunningHighLast=RunningLowLast;
   End;
End;

If DownLine then Begin
   value1=_DrawBox2(Red,T,D,T,D,RunningLow,RunningLowLast);
   Plot1(RunningLow,"Lb",Red);
End;
If UpLine then Begin
   value1=_DrawBox2(Green,T,D,T,D,RunningHighLast,RunningHigh);
   Plot1(RunningHigh,"Ub",Green);
End;

兩個函數
函數1    _ArrayStepper1Dim

Inputs:Arrayin(NumericArrayRef);
For Value1=(X-1) DownTo 1 Begin
Arrayin=ArrayIn;
End;
_ArrayStepper1Dim=0;

函數2 _DrawBox2

Input: _Color(NumericSimple),
       _TimeStart(NumericSimple),
       _DateStart(NumericSimple),
       _TimeEnd(NumericSimple),
       _DateEnd(NumericSimple),
       _PriceHi(NumericSimple),
       _PriceLo(NumericSimple);
      
Vars:Top(0),Bottom(0),Left(0),Right(0);

{Draw bottom line}
Bottom=TL_New(_DateStart,_TimeStart,_PriceLo,_DateEnd,_TimeEnd,_PriceLo);
TL_SetColor(Bottom,_Color);
{Draw top line}
Top=TL_New(_DateStart,_TimeStart,_PriceHi,_DateEnd,_TimeEnd,_PriceHi);
TL_SetColor(Top,_Color);
{Draw left line}
Left=TL_New(_DateStart,_TimeStart,_PriceLo,_DateStart,_TimeStart,_PriceHi);
TL_SetColor(Left,_Color);
{Draw right line}
Right=TL_New(_DateEnd,_TimeEnd,_PriceLo,_DateEnd,_TimeEnd,_PriceHi);
TL_SetColor(Right,_Color);

_DrawBox2=0;
頁: [1]
查看完整版本: 三價線程式碼哪裡有誤?