Trading System

Stel hier uw vragen over TA-script, of help anderen met het oplossen van hun probleem
Plaats reactie
Eric
Berichten: 3133
Lid geworden op: za sep 10, 2005 2:41 am
Locatie: Den Haag

Re: Trading System

Bericht door Eric » vr dec 20, 2019 8:21 pm

Je kunt de indicator al opnemen in een TAR rapport want hij heeft al een TAR waarde (op verzoek van PaulKr). Zie viewtopic.php?p=4010#p4010

Ik weet alleen niet wat zijn idee was voor de TAR adviestabel.

Wat wilde je zelf als TAR-waarde gebruiken? Of wil je eigenlijk alleen koop/verkoop zien?

---
Eric

Theo316
Berichten: 142
Lid geworden op: di dec 04, 2007 2:39 pm

Re: Trading System

Bericht door Theo316 » vr dec 20, 2019 9:45 pm

Ik wil graag de koop en verkoop zien als de kleur veranderd als dit kan

Eric
Berichten: 3133
Lid geworden op: za sep 10, 2005 2:41 am
Locatie: Den Haag

Re: Trading System

Bericht door Eric » za dec 21, 2019 12:13 pm

Dat kan:

Code: Selecteer alles

{- Filename: Trend for All Markets -}

var
  FastLen, MMLen, SlowLen, Length, StDv, Average1, Average2, Smooth, i: integer;
  xAvg1, bbMacd, xAvg21, xAvg22, xAvg23, xAvg31, xAvg32, xAvg33, mabbMacd : TSeries;
  sDev, upperBand, lowerBand, t3Trnd, t3TrndSmth, TARValue                : TSeries;
begin

{ Parameters }
  FastLen  := CreateParameterInteger('FastLen', 1, 999, 12, true);
  MMLen    := CreateParameterInteger('MMLen', 1, 999, 34, true);
  SlowLen  := CreateParameterInteger('SlowLen', 1, 999, 26, true);
  Length   := CreateParameterInteger('Length', 1, 999, 10, true);
  StDv     := CreateParameterInteger('StDv', 1, 999, 1, true);
  Average1 := CreateParameterInteger('Average1', 1, 999, 32, true);
  Average2 := CreateParameterInteger('Average2', 1, 999, 5, true);
  Smooth   := CreateParameterInteger('Smooth', 1, 999, 5, true);

{ Indicator eigenschappen }
  with Indicator do
  begin
    RequiredBars := 5*(SlowLen+Length+Average1+Average2);
  end;

{ Berekening }
  bbMacd     := MACD(Close, FastLen, SlowLen);
  mabbMacd   := Ma(bbMacd, maSimple,1);
  xAvg1      := MA(bbMacd, maExponential, Length);
  sDev       := StdDev(bbMacd, Length);
  upperBand  := AddSeries(xAvg1, MultiplySeriesBy(sDev, StDv));
  lowerBand  := SubtractSeries(xAvg1, MultiplySeriesBy(sDev, StDv));

  xAvg21     := MA(Momentum(Close, 1), maExponential, Average1);
  xAvg22     := MA(xAvg21, maExponential, Average2);
  xAvg23     := MA(xAvg22, maExponential, 1);
  xAvg31     := MA(AbsSeries(Momentum(Close, 1)), maExponential, Average1);
  xAvg32     := MA(xAvg31, maExponential, Average2);
  xAvg33     := MA(xAvg32, maExponential, 1);

  t3Trnd     := DivideSeries(xAvg23, xAvg33);
  t3TrndSmth := MA(t3Trnd, maExponential, Smooth);

  TARValue := FillSeries(CreateSeries(BarCount), 0);

  for i:=0 to BarCount-1 do
  begin
    if i>0 then TARValue[i] := TARValue[i-1];
    if IsValid(t3TrndSmth[i]) and IsValid(bbMacd[i]) then
    begin
      if (t3Trnd[i] <= t3TrndSmth[i]) AND (bbMacd[i] < upperBand[i]) THEN
      begin
        SetBarColor(1, i, clRed);
        EnterShort(i);
        TARValue[i] := -1;
      end else
      begin
        SetBarColor(1, i, clLime);
        EnterLong(i);
        TARValue[i] := 1;
      end;
    end;

    if IsValid(bbMacd[i]) then
    begin
      if (bbMacd[i] < 0) then
        SetBarColor(4, i, clRed)
      else
        SetBarColor(4, i, clBlue);
    end;
  end;

{ Weergave }
  with CreateLine(mabbMacd) do
  begin
    Name  := 'bbMacd-line';
    Color := clYellow;
    Width := 1;
  end;

  with CreateLine(bbMacd) do
  begin
    Name  := 'bbMacd';
    Color := clWhite;
    LineType := ltDot;
    Width := 3;
  end;

  with CreateLine(upperBand) do
  begin
    Name  := 'upperBand';
    Color := clGray;
  end;

  with CreateLine(lowerBand) do
  begin
    Name  := 'lowerBand';
    Color := clGray;
  end;

  with CreateLine(FillSeries(CreateSeries(BarCount), 0)) do
  begin
    Name     := 'Zero-line';
    Color    := clWhite;
    Width    := 2;
  end;

  with CreateLine(TARValue) do
  begin
    Name  := 'TAR';
    Color := clWhite;
    Visible := false;
    LineContent := lcTAR;
    Width := 1;
  end;
END.
De adviestabel dan instellen als volgt:
kleiner dan 0: Sell
groter: Buy

---
Eric

Theo316
Berichten: 142
Lid geworden op: di dec 04, 2007 2:39 pm

Re: Trading System

Bericht door Theo316 » za dec 21, 2019 12:23 pm

Dankjewel
Allemaal een prettige kerst en een goed uiteinde
Met vriendelijke groet Theo316

Bakstenen
Berichten: 533
Lid geworden op: zo jul 19, 2015 7:51 pm

Re: Trading System

Bericht door Bakstenen » wo mar 25, 2020 9:48 pm

Eric,
kan jij deze indicator uitbreiden zodat ook de 50% erin staat,
{- Filename: Fibo C -}

var
nBarsT,nStrengthT,nBarsB,nStrengthB,i,HighBar,LowBar : integer;
sTops,sBottoms : TIntArray;
vTop,vBottom,Y : real;
X1, X2, X3 : TDateTime;
cColor : TColor;
bShowPct,bShowPctL : boolean;
begin
// Parameter
nBarsT := CreateParameterInteger('Lookback Top', 1, 999, 8, true);
nBarsB := CreateParameterInteger('Lookback Bottom', 1, 999, 8, true);
cColor := CreateParameterColor('Color', clBlue);
bShowPct := CreateParameterBoolean('Percentages', true, false);
bShowPctL := CreateParameterBoolean('Percentages Left', true, false);
nStrengthT := nBarsT + 1;
nStrengthB := nBarsB + 1;

// Indicator eigenschappen---------------------------------------------------------
with Indicator do
begin
RequiredBars := nBarsB+100;
Shortname := 'Fibo'
NewBand := false;
ScaleRange := srCommon;
end;

// Indicatorberekening-------------------------------------------------------------
sTops := SwingHighIndexSeries(1, High, nStrengthT, nStrengthT+1);
sBottoms := SwingLowIndexSeries(1, Low, nStrengthB, nStrengthB+1);

for i:=0 to BarCount-1 do
begin
if (sTops = nStrengthT) then
begin
HighBar := i-nStrengthT;
vTop := High[i-nStrengthT];
end;

if (sBottoms = nStrengthB) then
begin
LowBar := i-nStrengthB;
vBottom := Low[i-nStrengthB];
end;

// Fibo-lijnen--------------------------------------------------------------------
if i = barcount - 1 then
begin
X1 := DateTime[MaxInt(HighBar, LowBar)-2];
X2 := DateTime[BarCount-1];
if bShowPctL then X3 := X1 else X3 := X2;

// Top-Bottom-Line
if (HighBar > LowBar) then
with CreateTrendline(DateTime[HighBar-1], vTop, DateTime[LowBar-1], vBottom) do
begin

Alvast bedankt

Theo316
Berichten: 142
Lid geworden op: di dec 04, 2007 2:39 pm

Re: Trading System

Bericht door Theo316 » do mar 26, 2020 1:45 am

Hallo Bakstenen
Deze gebruik ik kun je zelf kiezen(Ik weet alleen niet hoe je dit in 1 vak krijgt

Code: Selecteer alles

{- Filename: Fibonacci -}

                                          // *** version Theo - 2017-04-08 ***
// === Variables ===============================================================

var 
  nBarsT,nStrengthT,nBarsB,nStrengthB,i,HiBar,LoBar,nDispl,nDisplx : integer; 
  sTops, sBottoms                                                  : TIntArray; 
  vTop,vBot,xP                                                     : real;
  xHide,xVV,nDBC,xShHL                                             : boolean;
  xFiBo1,xFiBo2,xFiBo3,xFiBo4,xFiBo5,xFiBo6,xFiBo7,xFiBo8          : boolean;
  xFiBo9,xFiBo10,xFiBo11,xFiBo12,xShFib                            : boolean;
  ColX, ColZ,ColX1, ColZ1,ColX2, ColZ2,ColX3,ColZ3,
  ColX4,ColZ4,ColX5,ColZ5 ,ColX6,ColZ6                             : TColor;
  xFTB                                                             : string;
  X1,X2                                                            : TDateTime;

// === Procedures ==============================================================

// --- Procedure Plot Lines ----------------------------------------------------

procedure PlotTL(
    X0              : TDateTime; 
    Y0              : real;
    X1              : TDateTime;
    Y1              : real;
    aLineStyle      : TTrendLineStyle;
    aColor          : TColor;
    bDBC            : boolean;
    bVV             : boolean);

begin
  with CreateTrendline(X0, Y0, X1, Y1) do
  begin
    ExtendLeft      := false;
    ExtendRight     := true;
    Style           := aLineStyle;
    Color           := aColor;
    DrawBehindChart := bDBC;
    ValueVisible    := bVV;
  end;
end; 

// --- Procedure Plot Text -----------------------------------------------------

procedure PlotText(
    DT              : TDateTime;
    Price           : real; 
    sString         : string; 
    txVertPosition  : TVertPosition;
    txHorzPosition  : THorzPosition;
    aColor          : TColor);

begin 
  with CreateText(DT, Price, sString) do 
  begin 
    HorzPosition    := txHorzPosition;
    VertPosition    := txVertPosition; 
    UseBkColor      := false;
    Color           := aColor;
    DrawBehindChart := false;
  end; 
end; 

// === BEGIN ===================================================================

BEGIN

  // --- Indicator Properties --------------------------------------------------  

  with Indicator do 
  begin 
    RequiredBars  := nBarsB+100; 
    Shortname     := 'Fibo'
    NewBand       := false;
    ScaleRange    := srCommon;
    HiddenParams  := true; 
  end;

  // --- Indicator Parameters -------------------------------------------------- 

  xHide  := CreateParameterBoolean(' Hide All',false,false);
  nBarsT := CreateParameterInteger(' Lookback Top',1,999,8,false);
  nBarsB := CreateParameterInteger(' Lookback Bottom',1,999,8,false);
  ColX   := CreateParameterColor  (' Color Fibo Levels',RGB(221,160,221));
  ColX1  := CreateParameterColor  (' Color Fibo Levels',clRed);
  ColX2  := CreateParameterColor  (' Color Fibo Levels',clBlue);
  ColX3  := CreateParameterColor  (' Color Fibo Levels',RGB(205,205,000));
  ColX4   := CreateParameterColor  (' Color Fibo Levels',RGB(186,85,211));
  ColX5   := CreateParameterColor  (' Color Fibo Levels',RGB(255,193,037));
  ColX6   := CreateParameterColor  (' Color Fibo Levels',RGB(060,179,113));
  nDispl := CreateParameterInteger(' Displace Lines',1,32,1,false);
  xFiBo1 := CreateParameterBoolean(' Show 23.6% Fibo-retracement',false,false);
  xFiBo2 := CreateParameterBoolean(' Show 38.2% Fibo-retracement',true,false);
  xFiBo3 := CreateParameterBoolean(' Show 50.0% Fibo-retracement',false,false);
  xFiBo4 := CreateParameterBoolean(' Show 61.8% Fibo-retracement',true,false);
  xFiBo5 := CreateParameterBoolean(' Show 78.6% Fibo-retracement',false,false);
  xFiBo6 := CreateParameterBoolean(' Show 88.6% Fibo-retracement',false,false);
  xFiBo7 := CreateParameterBoolean(' Show 127.2% Fibo-retracement',true,false);
  xFiBo8 := CreateParameterBoolean(' Show 141.4% Fibo-retracement',false,false);
  xFiBo9 := CreateParameterBoolean(' Show 161.8% Fibo-retracement',false,false);
  xFiBo10:= CreateParameterBoolean(' Show -0.27.2% Fibo-retracement',true,false);
  xFiBo11:= CreateParameterBoolean(' Show -0.41.4% Fibo-retracement',false,false);
  xFiBo12:= CreateParameterBoolean(' Show -0.61.8% Fibo-retracement',false,false);
  xShFib := CreateParameterBoolean(' Show Percents',true,false);  
  xVV    := CreateParameterBoolean(' Price Visible',false,false);
  xShHL  := CreateParameterBoolean(' Show Line HiLo Pivots',true,false);
  ColZ   := CreateParameterColor(' Color PivotLine',RGB(224,224,224));
  nDBC   := CreateParameterBoolean(' Draw Behind Chart',false,false);

  // --- Indicator Calculation & Display Fibo Lines ----------------------------  

  nStrengthT := nBarsT + 1;
  nStrengthB := nBarsB + 1; 

  sTops      := SwingHighIndexSeries(1,High,nStrengthT,nStrengthT+1); 
  sBottoms   := SwingLowIndexSeries(1,Low,nStrengthB,nStrengthB+1); 

  for i:=0 to BarCount-1 do 
  begin 

    // -------------------------------------------------------

    if (sTops[i] = nStrengthT) then 
    begin 
      HiBar   := i-nStrengthT; 
      vTop    := High[i-nStrengthT]; 
    end; 

    if (sBottoms[i] = nStrengthB) then 
    begin 
      LoBar   := i-nStrengthB; 
      vBot    := Low[i-nStrengthB]; 
    end; 

    // --- Fibo Lines ----------------------------------------

    if (i = barcount - 1) and not xHide then
    begin 

      X1 := BarPosition[MaxInt(HiBar,LoBar)-nDispl];
      X2 := BarPosition[BarCount-nDispl];

      // --- Pivot-Line ---------------------------

      if xShHL then
      with CreateTrendline(BarPosition[HiBar],vTop,BarPosition[LoBar],vBot) do 
      begin
        Style           := lsDot;
        DrawBehindChart := true;
        Color           := ColZ;
        Color           := ColZ1;
        Color           := ColZ2;
        Color           := ColZ3;
      end;   

      // --- Line over Top ------------------------

      if (HiBar < LoBar) then nDisplx := 1 else nDisplx := nDispl;
      PlotTL(BarPosition[HiBar-nDisplx],vTop,X2,vTop,lsSolid,ColX2,nDBC,xVV);
      if xShFib then
      begin
        if (HiBar < LoBar) then xFTB := '100%' else xFTB := '0%';
        PlotText(X1,vTop,xFTB,vpTop,hpRight,ColX2);
      end;

      // --- Line over Bottom ---------------------

      if (HiBar > LoBar) then nDisplx := 1 else nDisplx := nDispl;
      PlotTL(BarPosition[LoBar-nDisplx],vBot,X2,vBot,lsSolid,ColX1,nDBC,xVV);
      if xShFib then
      begin
        if (HiBar > LoBar) then xFTB := '100%' else xFTB := '0%';
        PlotText(X1,vBot,xFTB,vpTop,hpRight,ColX1);
      end;

      // --- 0.236 --------------------------------
      
      if xFiBo1 then
      begin
        if (HiBar < LoBar) then
          xP := vBot +((vTop-vBot)*0.236) else
          xP := vTop -((vTop-vBot)*0.236);
        PlotTL(X1,xP,X2,xP,lsDot,ColX3,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'23.6%',vpTop,hpRight,ColX3);
      end;

      // --- 0.382 --------------------------------

      if xFiBo2 then
      begin
        if (HiBar < LoBar) then 
          xP := vBot +((vTop-vBot)*0.382) else
          xP := vTop -((vTop-vBot)*0.382);
        PlotTL(X1,xP,X2,xP,lsDot,ColX1,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'38.2%',vpTop,hpRight,ColX1);
      end;

      // --- 0.500 --------------------------------

      if xFiBo3 then
      begin
        PlotTL(X1,(vTop+vBot)/2,X2,(vTop+vBot)/2,lsDot,ColX,nDBC,xVV);
        if xShFib then PlotText(X1,(vTop+vBot)/2,'50%',vpTop,hpRight,ColX);
      end;
      
      // --- 0.618 --------------------------------

      if xFiBo4 then
      begin
        if (HiBar < LoBar) then 
          xP := vBot +((vTop-vBot)*0.618) else
          xP := vTop -((vTop-vBot)*0.618);
        PlotTL(X1,xP,X2,xP,lsDot,ColX6,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'61.8%',vpTop,hpRight,ColX6);
      end;

      // --- 0.786 --------------------------------

      if xFiBo5 then
      begin
        if (HiBar < LoBar) then 
          xP := vBot +((vTop-vBot)*0.786) else
          xP := vTop -((vTop-vBot)*0.786);
        with CreateTrendline(X1,xP,X2,xP) do
        begin 
          ExtendRight     := true; 
          DrawBehindChart := nDBC;
          ValueVisible    := xVV;
          Style           := lsDot;
          Color           := ColX;
        end; 
        if xShFib then PlotText(X1,xP,'78.6%',vpTop,hpRight,ColX);
      end;
              // --- 0.886 --------------------------------

      if xFiBo6 then
      begin
        if (HiBar < LoBar) then
          xP := vBot +((vTop-vBot)*0.886) else
          xP := vTop -((vTop-vBot)*0.886);
        with CreateTrendline(X1,xP,X2,xP) do
        begin
          ExtendRight     := true;
          DrawBehindChart := nDBC;
          ValueVisible    := xVV;
          Style           := lsDot;
          Color           := ColX3;
        end;
        if xShFib then PlotText(X1,xP,'88.6%',vpTop,hpRight,ColX3);
      end;
      // --- 1.272 --------------------------------

      if xFiBo7 then
      begin
        if (HiBar < LoBar) then 
          xP := vBot +((vTop-vBot)*1.272) else
          xP := vTop -((vTop-vBot)*1.272);
        PlotTL(X1,xP,X2,xP,lsDot,ColX,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'127.2%',vpTop,hpRight,ColX);
      end;
          // --- 1.414 --------------------------------

      if xFiBo8 then
      begin
        if (HiBar < LoBar) then
          xP := vBot +((vTop-vBot)*1.414) else
          xP := vTop -((vTop-vBot)*1.414);
        PlotTL(X1,xP,X2,xP,lsDot,ColX3,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'141.4%',vpTop,hpRight,ColX3);
      end;
      // --- 1.618 --------------------------------

      if xFiBo9 then
      begin
        if (HiBar < LoBar) then 
          xP := vBot +((vTop-vBot)*1.618) else
          xP := vTop -((vTop-vBot)*1.618);
        PlotTL(X1,xP,X2,xP,lsDot,ColX2,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'161.8%',vpTop,hpRight,ColX2);
      end;
             // --- -0.272 --------------------------------

      if xFiBo10 then
      begin
        if (HiBar < LoBar) then
          xP := vBot +((vTop-vBot)*-0.272) else
          xP := vTop -((vTop-vBot)*-0.272);
        PlotTL(X1,xP,X2,xP,lsDot,ColX4,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'-0.27.2%',vpTop,hpRight,ColX4);
      end;
                  // --- -0.414 --------------------------------

      if xFiBo11 then
      begin
        if (HiBar < LoBar) then
          xP := vBot +((vTop-vBot)*-0.414) else
          xP := vTop -((vTop-vBot)*-0.414);
        PlotTL(X1,xP,X2,xP,lsDot,ColX5,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'-0.41.4%',vpTop,hpRight,ColX5);
      end;
                       // --- -0.618 --------------------------------

      if xFiBo12 then
      begin
        if (HiBar < LoBar) then
          xP := vBot +((vTop-vBot)*-0.618) else
          xP := vTop -((vTop-vBot)*-0.618);
        PlotTL(X1,xP,X2,xP,lsDot,ColX6,nDBC,xVV);
        if xShFib then PlotText(X1,xP,'-0.61.8%',vpTop,hpRight,ColX6);
      end;
    // --------------------------------------------      

    end; 

  // ---------------------------------------------------------

  end; 

  // ---------------------------------------------------------------------------
END.
// === END =====================================================================

Eric
Berichten: 3133
Lid geworden op: za sep 10, 2005 2:41 am
Locatie: Den Haag

Re: Trading System

Bericht door Eric » do mar 26, 2020 4:30 pm

Bakstenen schreef:
wo mar 25, 2020 9:48 pm
Eric,
kan jij deze indicator uitbreiden zodat ook de 50% erin staat,
Dat wordt deze:

Code: Selecteer alles

{- Filename: Fibo C -}

var 
  nBarsT,nStrengthT,nBarsB,nStrengthB,i,HighBar,LowBar  : integer; 
  sTops,sBottoms                                        : TIntArray; 
  vTop,vBottom,Y                                        : real; 
  X1, X2                                                : TDateTime;
  cColor                                                : TColor;
  bShowPct: boolean;
begin 
  // Parameter 
  nBarsT     :=  CreateParameterInteger('Lookback Top', 1, 999, 8, true); 
  nBarsB     :=  CreateParameterInteger('Lookback Bottom', 1, 999, 8, true);
  cColor     := CreateParameterColor('Color', clBlue);
  bShowPct := CreateParameterBoolean('Percentages', true, false);
  nStrengthT :=  nBarsT + 1; 
  nStrengthB :=  nBarsB + 1; 
  
  // Indicator eigenschappen---------------------------------------------------------  
  with Indicator do 
  begin 
    RequiredBars  := nBarsB+100; 
    Shortname     := 'Fibo' 
    NewBand       := false; 
    ScaleRange    := srCommon; 
  end; 

  // Indicatorberekening-------------------------------------------------------------  
  sTops           := SwingHighIndexSeries(1, High, nStrengthT, nStrengthT+1); 
  sBottoms        := SwingLowIndexSeries(1, Low, nStrengthB, nStrengthB+1); 

  for i:=0 to BarCount-1 do 
  begin 
    if (sTops[i] = nStrengthT) then 
    begin 
      HighBar     := i-nStrengthT; 
      vTop        := High[i-nStrengthT]; 
    end; 

    if (sBottoms[i] = nStrengthB) then 
    begin 
      LowBar      := i-nStrengthB; 
      vBottom     := Low[i-nStrengthB]; 
    end; 

  // Fibo-lijnen-------------------------------------------------------------------- 
    if i = barcount - 1 then 
    begin 
       X1 := DateTime[MaxInt(HighBar, LowBar)-2];
       X2 := DateTime[BarCount-1];

      // Top-Bottom-Line 
      if (HighBar > LowBar) then 
      with CreateTrendline(DateTime[HighBar-1], vTop, DateTime[LowBar-1], vBottom) do 
        begin 
          Style        := lsDot; 
          Color        := cColor; 
         end; 
      if (HighBar < LowBar) then 
      with CreateTrendline(DateTime[HighBar-1], vTop, DateTime[LowBar-1], vBottom) do 
        begin 
          Style        := lsDot; 
          Color        := cColor; 
         end; 

      // Top 
      with CreateTrendline(DateTime[HighBar-2], vTop, DateTime[BarCount-1], vTop) do 
        begin 
          ExtendRight  := true; 
          Style        := lsSolid; 
          Color        := cColor; 
         end;
        if bShowPct then with CreateText(X2, vTop, '100%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // -0.618
       Y := vBottom-((vTop-vBottom)*0.618);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true;
          Style        := lsDot;
          Color        := cColor;
        end;
        if bShowPct then with CreateText(X2, Y, '-61.8%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // -0.5
       Y := vBottom-((vTop-vBottom)*0.5);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true;
          Style        := lsDot;
          Color        := cColor;
        end;
        if bShowPct then with CreateText(X2, Y, '-50%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // -0.328
       Y := vBottom-((vTop-vBottom)*0.382);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true;
          Style        := lsDot;
          Color        := cColor;
        end;
        if bShowPct then with CreateText(X2, Y, '-32.8%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // 0.382
       Y := vBottom+((vTop-vBottom)*0.382);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true; 
          Style        := lsDot; 
          Color        := cColor; 
        end; 
        if bShowPct then with CreateText(X2, Y, '32.8%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // 0.5
       Y := vBottom+((vTop-vBottom)*0.5);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true;
          Style        := lsDot;
          Color        := cColor;
        end;
        if bShowPct then with CreateText(X2, Y, '50%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // 0.618
       Y := vBottom+((vTop-vBottom)*0.618);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true; 
          Style        := lsDot; 
          Color        := cColor; 
        end; 
        if bShowPct then with CreateText(X2, Y, '61.8%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // Bottom
       with CreateTrendline(DateTime[LowBar-2], vBottom, DateTime[BarCount-1], vBottom) do
        begin
          ExtendRight   := true; 
          Style         := lsSolid; 
          Color         := cColor; 
        end; 
        if bShowPct then with CreateText(X2, vBottom, '0%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // 1.382
       Y := vBottom+((vTop-vBottom)*1.382);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true;
          Style        := lsDot;
          Color        := cColor;
        end;
        if bShowPct then with CreateText(X2, Y, '138.2%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

       // 1.618
       Y := vBottom+((vTop-vBottom)*1.618);
       with CreateTrendline(X1, Y, X2, Y) do
        begin
          ExtendRight  := true;
          Style        := lsDot;
          Color        := cColor;
        end;
        if bShowPct then with CreateText(X2, Y, '161.8%') do
        begin
          HorzPosition := hpRight;
          VertPosition := vpTop;
          Color := cColor;
        end;

      end;
   end; 
END.
---
Eric

Bakstenen
Berichten: 533
Lid geworden op: zo jul 19, 2015 7:51 pm

Re: Trading System

Bericht door Bakstenen » do mar 26, 2020 5:58 pm

Theo en Eric, super bedankt, werkt goed.

Plaats reactie