COCO研究院

 找回密碼
 註冊
搜索
查看: 3167|回復: 0

三價線程式碼哪裡有誤?

[複製鏈接]
發表於 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[Value2]=999999;
   end;
   RunningHigh=C;
   RunningHighLast=O;
   LastBars[1]=O;
   UpLine=TRUE;
   DownLine=FALSE;
end;

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

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

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

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

兩個函數
函數1    _ArrayStepper1Dim

Inputs:Arrayin[X](NumericArrayRef);
For Value1=(X-1) DownTo 1 Begin
Arrayin[Value1+1]=ArrayIn[Value1];
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;
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-11-29 04:13

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |