Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
var0 = SwingHigh( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 <= 0 and var0 >= var1 + RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = 1 ;
end
else
begin
condition1 = var4 = 1 and var0 >= var1 ;
if condition1 then
begin
var5 = true ;
var7 = true ;
end;
end ;
end
else
begin
var0 = SwingLow( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 >= 0 and var0 <= var1 - RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = -1 ;
end
else
begin
condition1 = var4 = -1 and var0 <= var1 ;
if condition1 then
begin
var5 = true;
var7 = true ;
end ;
end;
end ;
end ;
if var5 then
begin
var1 = var0 ;
var2 = Date[1] ;
var3 = Time[1] ;
var5 = false ;
end ;
variables:
NewSwingPrice( 0 ),
SwingPrice( Price ), { used as a convenient 2-element array }
SwingDate( Date ), { used as a convenient 2-element array }
SwingTime( Time ), { used as a convenient 2-element array }
TLDir( 0 ), { TLDir = -1 implies prev TL dn, +1 implies prev TL up }
SaveSwing( false ),
AddTL( false ),
UpdateTL( false ),
TLRef( 0 ) ;
{ Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi's and SwingLo's }
NewSwingPrice = SwingHigh( 1, Price, 1, 2 ) ;
if NewSwingPrice <> -1 then
begin
if TLDir <= 0 and NewSwingPrice >= SwingPrice + RetracePnts then
{ prepare to add new up TL }
begin
SaveSwing = true ;
AddTL = true ;
TLDir = 1 ;
end
else if TLDir = 1 and NewSwingPrice >= SwingPrice then
{ prepare to update prev up TL }
begin
SaveSwing = true ;
UpdateTL = true ;
end ;
end
else
begin
NewSwingPrice = SwingLow( 1, Price, 1, 2 ) ;
if NewSwingPrice <> -1 then
begin
if TLDir >= 0 and NewSwingPrice <= SwingPrice - RetracePnts then
{ prepare to add new dn TL }
begin
SaveSwing = true ;
AddTL = true ;
TLDir = -1 ;
end
else if TLDir = -1 and NewSwingPrice <= SwingPrice then
{ prepare to update prev dn TL }
begin
SaveSwing = true;
UpdateTL = true ;
end ;
end ;
end ;
if SaveSwing then
{ save new swing and reset SaveSwing }
begin
SwingPrice = NewSwingPrice ;
SwingDate = Date[1] ;
SwingTime = Time[1] ;
SaveSwing = false ;
end ;
if AddTL then
{ add new TL and reset AddTL }
begin
TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1],
SwingPrice[1] ) ;
TL_SetExtLeft( TLRef, false ) ;
TL_SetExtRight( TLRef, false ) ;
TL_SetSize( TLRef, LineWidth ) ;
TL_SetColor( TLRef, LineColor ) ;
AddTL = false ;
end
else if UpdateTL then
{ update prev TL and reset UpdateTL }
begin
TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ;
UpdateTL = false ;
end ;
-------------------------------------------------------------------------------------
Thanks for the code. Any idea how I could modify it in such a way that the indicator can show up and down arrows at the turning points instead of lines ?
Unfortunately I do not know how to insert arrows instead of lines, but the ZigZag indicator is not very reliable, because it often modifies the previous signal, it is as if a trader went back in time and could modify the signals: they would all be rich.
"Since the Zig Zag indicator can adjust its values based on subsequent changes in the underlying plot, it has perfect hindsight into what prices have done. Please don't try to create a trading system based on the Zig Zag indicator - its hindsight is much better than its foresight!"
I have figured out the up and down arrow portion., but there's a unwanted orange zigzag line that I would like to remove. Can some one please tell me which line of code I need to delete to achieve that ?
var0 = SwingHigh( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 <= 0 and var0 >= var1 + RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = 1 ;
end
else
begin
condition1 = var4 = 1 and var0 >= var1 ;
if condition1 then
begin
var5 = true ;
var7 = true ;
end;
end ;
end
else
begin
var0 = SwingLow( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 >= 0 and var0 <= var1 - RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = -1 ;
end
else
begin
condition1 = var4 = -1 and var0 <= var1 ;
if condition1 then
begin
var5 = true;
var7 = true ;
end ;
end;
end ;
end ;
if var5 then
begin
var1 = var0 ;
var2 = Date[1] ;
var3 = Time[1] ;
var5 = false ;
end ;
I have simplified the codes. Can some one please please tell me how I could remove or change the color of the Zigzag line ? The up and down arrows are good enough for me. A million thanks in advance. I've tried to examine each line, but I can't figure it out.
var0 = SwingHigh( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 <= 0 and var0 >= var1 + RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = 1 ;
end
else
begin
condition1 = var4 = 1 and var0 >= var1 ;
if condition1 then
begin
var5 = true ;
var7 = true ;
end;
end ;
end
else
begin
var0 = SwingLow( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 >= 0 and var0 <= var1 - RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = -1 ;
end
else
begin
condition1 = var4 = -1 and var0 <= var1 ;
if condition1 then
begin
var5 = true;
var7 = true;
end ;
end;
end ;
end ;
if var5 then
begin
var1 = var0 ;
var2 = Date[1] ;
var3 = Time[1] ;
var5 = false ;
end ;
I am able to add these lines to make the unwanted zigzag line black which is the same color as the background. Just wondering if there's a reserved word color for transparent or how I can get a RGB color code to substitute transparent color ?
var0 = SwingHigh( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 <= 0 and var0 >= var1 + RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = 1 ;
end
else
begin
condition1 = var4 = 1 and var0 >= var1 ;
if condition1 then
begin
var5 = true ;
var7 = true ;
end;
end ;
end
else
begin
var0 = SwingLow( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 >= 0 and var0 <= var1 - RetracePnts ;
if condition1 then
begin
var5 = true ;
var6 = true ;
var4 = -1 ;
end
else
begin
condition1 = var4 = -1 and var0 <= var1 ;
if condition1 then
begin
var5 = true;
var7 = true;
end ;
end;
end ;
end ;
if var5 then
begin
var1 = var0 ;
var2 = Date[1] ;
var3 = Time[1] ;
var5 = false ;
end ;
there is the Reserved word: transparent, but maybe it is only for Tradestation 10, because in my Tradestation 8 it is not there (see image), maybe it is not even in Multicharts.
I wanted to ask you if you can write here the Function of Donchian Channel.
Thank you a lot.