Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Tams

Trendline (EasyLanguage)

Recommended Posts

Thats odd AAA the code you posted should run once a day! It should not slow things down.

 

It's OK over 1 mn chart (5, 15 etc...)

 

Could you try on a 1 mn chart, wait 1 hour and resize the graph multiple times and let me know if it' OK ?

 

Multicharts rasterisation had always been snotbag slow,

 

I'm new with MC and it's true that resizing is not as fluent as other softwares

 

I use 2 screens 1920 x 1200 and I thought it was hard for GPU to manage all pixels

 

The best is that nevere ever I crashed MC eventho it turns 10 hours a day

Share this post


Link to post
Share on other sites

I've just status on the indicator

 

resizing 3 times with the mouse on the price scale and moved down 4 times with the pad

 

and now the screen is frozen during 10 seconds each time I move up or down

 

Now status off

 

And it's OK with a "normal" 1-2 seconds delay resizing

Share this post


Link to post
Share on other sites

I think that I've found

 

I recompile the indicator and now it's OK

 

May be the last compilation crashed ?

 

Anyway, thank you for your patience

Share this post


Link to post
Share on other sites

For those interested with problems with MC

 

(If I'm out of subject, please send me a private message and I will ask to the moderator to erase them)

 

I've made a 2 weeks ghost and now MC is quicker to redraw rasters/screen

 

As a detective I'm wondering if these upgrades programms since my ghost was guilty

 

IE8

Office2007 SP2

ATI driver

 

IE8 was in conflit with a soft

Office SP2 crashed badly and I had to reinstall from the CD

ATI drives the rasters...

 

Yesterday I had 280 Mo free space left on my C: with a 1 Mo pagefile

 

After "ghosting" I had 2.2 Go free space

 

What happened with the 1,92 Go ?

 

 

I am ghosting, (with a diary of EVERY changed done) since 8 years and it's a nice way to keep a computer safe and resolve problems.

 

I hope that I've helped with this message

Share this post


Link to post
Share on other sites

How to change the width of a trendline

 

 

TL_SetSize

 

Assigns the specified width to a trendline with the specified ID number;

returns a value of 0 if the line width was successfully assigned,

and a value of -2 if the specified trendline ID number is invalid.

 

 

Usage

 

TL_SetSize( TL_ID, LineWidth )

 

Where:

TL_ID - a numerical expression specifying the trendline ID number

LineWidth - a numerical expression specifying the trendline width;

trendline width can range from 0 to 6

 

 

Note

 

A trendline-specific ID number is returned by TL_New when the trendline is created.

 

 

Example

 

Assign the width of 5 to the trendline with an ID number of 3:

 

Value1 = TL_SetSize( 3, 5 );

Share this post


Link to post
Share on other sites

This example is from the Trendline Automatic indicator.

 

I have added user configurable trendline width.

The added code is highlighted by: {<--- added line}

 

Enjoy!

 

 

 

{ 
This indicator:
(1) INSERTS DnTL's/UpTL's connecting each new SwingHi/SwingLo with the next most 
   recent higher/lower SwingHi/SwingLo within the last 10 SwingHi's/SwingLo's; 
(2) EXTENDS each new TL to the right and SETS it's color and alert type; 
(3) TRUNCATES a DnTL/UpTL on the right when the next new DnTL/UpTL is drawn (if the 
   History input is set to "Yes"), or BarsPast bars after it has been breached, 
   whichever comes first.
(4) DELETES a DnTL/UpTL when the next new DnTL/UpTL is drawn, if the History input 
   is set to "No".

NOTE: This indicator may not work well with low-count tick bars, such as 10-tick bars, 
etc., because the time resolution of the bars may not be high enough for each bar to 
have a distinct time stamp.
}

inputs: 
SwHiStrength( 4 ), 
SwLoStrength( 4 ), 
BarsPast( 10 ), 
History( "Yes" ), 
DnTLColor( Red ), 
UpTLColor( Cyan ), 
AlertType( "IntraBar" ) ,

width(1); {<--- added line}

variables: 
DnTLRef( -1 ), 
DnTLEndBar( 0 ), 
DnTLBreak( false ), 
DnTLColorNum( DnTLColor ), 

UpTLRef( -1 ), 
UpTLEndBar( 0 ), 
UpTLBreak( false ), 
UpTLColorNum( UpTLColor ), 

Index( 0 ), 
BarNum( 0 ), 
HistoryTF( false ), 
AlertTypeCAPS( UpperStr( AlertType ) ) ;

arrays: 
SwHiDate[10]( 0 ), 
SwHiTime[10]( 0 ), 
SwHiVal[10]( -1000000 ), 
SwLoDate[10]( 0 ), 
SwLoTime[10]( 0 ), 
SwLoVal[10]( 1000000 ) ;

if CurrentBar = 1 then 
HistoryTF = UpperStr( History ) = "YES" or UpperStr( History ) = "Y" ;
{ should also be able to do this via declaration above }

BarNum = BarNumber ;

if SwingHighBar( 1, High, SwHiStrength, SwHiStrength + 1 ) = SwHiStrength then 
{ ie, if just confirmed SwHi }
begin

{ push arrays back }
for Value1 = 9 downto 0 
	begin
	SwHiDate[ Value1 + 1 ] = SwHiDate[Value1] ;
	SwHiTime[ Value1 + 1 ] = SwHiTime[Value1] ;
	SwHiVal[ Value1 + 1 ] = SwHiVal[Value1] ;
	end ;

{ read in parameters of new SwHi into 0-elements of arrays }
SwHiDate[0] = Date[swHiStrength] ;
SwHiTime[0] = Time[swHiStrength] ;
SwHiVal[0] = High[swHiStrength] ;

{ find and save the index of the next-most-recent higher SwHi if it exists }
for Value2 = 1 to 10 
	begin
	if SwHiVal[Value2] > SwHiVal[0] then 
		begin
		Index = Value2 ;
		Value2 = 11 ; { short circuit the looping with 11 instead of 10; the 11
		 will become 12 in the final pass }
		end ;
	end ;

if Value2 = 12 then { ie, if next-most-recent higher SwHi exists }
	begin
	if DnTLRef >= 0 then  { ie, if previous DnTL exists }
		begin
		if HistoryTF and DnTLBreak = false then 
			{ if history reqd and most recent DnTL not already truncated 
			  elsewhere, truncate it now }
			begin
			TL_SetEnd( DnTLRef, Date, Time, TL_GetValue( DnTLRef, Date, Time ) ) ;
			TL_SetExtRight( DnTLRef, false ) ;
			end
		else if HistoryTF = false then
			{ if history not reqd, delete most recent DnTL }
			TL_Delete( DnTLRef ) ;
		end ;
	{ draw new DnTL, reset break flag, save endbar, set extents/color/alert }
	DnTLRef = TL_New( SwHiDate[index], SwHiTime[index], SwHiVal[index], 
	 SwHiDate[0], SwHiTime[0], SwHiVal[0] ) ;

	TL_SetSize( DnTLRef, width ); {<--- added line}

	if DnTLBreak = true then 
		DnTLBreak = false ;
	DnTLEndBar = BarNum - SwHiStrength ;
	TL_SetExtLeft( DnTLRef, false ) ;
	TL_SetExtRight( DnTLRef, true ) ;
	if DnTLColorNum <> 99 then 
		TL_SetColor( DnTLRef, DnTLColorNum ) ;
	if AlertTypeCAPS = "ONCLOSE" then 
		TL_SetAlert( DnTLRef, 2 )
	else if AlertTypeCAPS = "INTRABAR" then 
		TL_SetAlert( DnTLRef, 1 )
	else
		TL_SetAlert( DnTLRef, 0 ) ;
	end ;
end ;

if SwingLowBar( 1, Low, SwLoStrength, SwLoStrength + 1 ) = SwLoStrength then 
{ ie, if just confirmed SwLo }
begin

{ push arrays back }
for Value1 = 9 downto 0 
	begin
	SwLoDate[Value1+1] = SwLoDate[Value1] ;
	SwLoTime[Value1+1] = SwLoTime[Value1] ;
	SwLoVal[Value1+1] = SwLoVal[Value1] ;
	end ;

{ read in parameters of new SwLo into 0-elements of arrays }
SwLoDate[0] = Date[swLoStrength] ;
SwLoTime[0] = Time[swLoStrength] ;
SwLoVal[0] = Low[swLoStrength] ;

{ find and save the index of the next-most-recent lower SwLo if it exists }
for Value2 = 1 to 10 
	begin
	if SwLoVal[Value2] < SwLoVal[0] then 
		begin
		Index = Value2 ;
		Value2 = 11 ;{ short circuit the looping with 11 instead of 10; the 11
		 will become 12 in the final pass }
		end ;
	end ;

if Value2 = 12 then  { ie, if next-most-recent lower SwLo exists }
	begin
	if UpTLRef >= 0 then { ie, if previous UpTL exists }
		begin
		if HistoryTF and UpTLBreak = false then 
			{ if history reqd and most recent UpTL not already truncated 
			  elsewhere, truncate it now }
			begin
			TL_SetEnd( UpTLRef, Date, Time, TL_GetValue( UpTLRef, Date, Time ) ) ;
			TL_SetExtRight( UpTLRef, false ) ;
			end
		else if HistoryTF = false then
			{ if history not reqd, delete most recent UpTL }
			TL_Delete( UpTLRef ) ;
		end ;
	{ draw new UpTL, reset break flag, save endbar, set extents/color/alert }
	UpTLRef = TL_New( SwLoDate[index], SwLoTime[index], SwLoVal[index], 
	 SwLoDate[0], SwLoTime[0], SwLoVal[0] ) ;

	TL_SetSize( UPTLRef, width ); {<--- added line}

	if UpTLBreak = true then
		UpTLBreak = false ;
	UpTLEndBar = BarNum - SwLoStrength ;
	TL_SetExtLeft( UpTLRef, false ) ;
	TL_SetExtRight( UpTLRef, true ) ;
	if UpTLColorNum <> 99 then 
		TL_SetColor( UpTLRef, UpTLColorNum ) ;
	if AlertTypeCAPS = "ONCLOSE" then 
		TL_SetAlert( UpTLRef, 2 )
	else if AlertTypeCAPS = "INTRABAR" then 
		TL_SetAlert( UpTLRef, 1 )
	else
		TL_SetAlert( UpTLRef, 0 ) ;
	end ;
end ;

{ if most recent DnTL/UpTL exists AND has not yet been truncated here AND was drawn 
 at least BarsPast ago AND was breached BarsPast bars ago THEN truncate it here and 
 set break flag }

if DnTLRef >= 0 
and DnTLBreak = false
and BarNum > DnTLEndBar + SwHiStrength + BarsPast 
and ( Close > TL_GetValue( DnTLRef, Date, Time ) )[barsPast]
then 
begin
TL_SetEnd( DnTLRef, Date, Time, TL_GetValue( DnTLRef, Date, Time ) ) ;
TL_SetExtRight( DnTLRef, false ) ;
DnTLBreak = true ;
end ;

if UpTLRef >= 0 
and UpTLBreak = false
and BarNum > UpTLEndBar + SwLoStrength + BarsPast 
and ( Close < TL_GetValue( UpTLRef, Date, Time ) )[barsPast]
then 
begin
TL_SetEnd( UpTLRef, Date, Time, TL_GetValue( UpTLRef, Date, Time ) ) ;
TL_SetExtRight( UpTLRef, false ) ;
UpTLBreak = true ;
end ;


{ ** Copyright (c) 1991-2003 TradeStation Technologies, Inc. All rights reserved. ** 
 ** TradeStation reserves the right to modify or overwrite this analysis technique 
    with each release. ** }

Share this post


Link to post
Share on other sites

Trend line related keywords

 

TL_SetAlert

 

TL_SetBegin

TL_SetEnd

 

TL_SetColor

 

TL_SetExtLeft

TL_SetExtRight

 

TL_SetSize

TL_SetStyle

 

 

.

Edited by Tams

Share this post


Link to post
Share on other sites

Hi all,

 

I am fairly new to the forum and I am appreciating all of the great solutions already posted here. I have spent quite a few hours working on a trendline study and I am at a place where I am stuck. Attached screenshot explains what I am attempting to do. I have placed horizontal trendlines on a chart based on the last 10 pivots (number of pivots is not relevant). Some of the pivots have been "taken out" by a higher high and are not relevant. I wish to retain and draw lines only on the relevant pivots.

 

What is the best way to accomplish this? I have tried - to write a formula comparing a new pivot to the previous 10, and adding a 2nd array that would store the relevant pivots. the 2nd method works OK, but requires the array to be cleared out each time a new value is added and I have no idea how to do that.

 

I appreciate any assistance on this and thanks in advance.

 

WT

5aa71030784dd_arraytrendlines.thumb.png.56aad3459c945b903db3c1edfddd973e.png

Share this post


Link to post
Share on other sites
didn't you ask this question before with another handle?

 

 

 

heh, not that i am aware of.

 

thanks for the tip. i will search more to see if that question has been asked before. my apologies if it has been duplicated.

Share this post


Link to post
Share on other sites
This example is from the Trendline Automatic indicator.

 

I have added user configurable trendline width.

The added code is highlighted by: {<--- added line}

 

Enjoy!

 

 

 

{ 
This indicator:
(1) INSERTS DnTL's/UpTL's connecting each new SwingHi/SwingLo with the next most 
   recent higher/lower SwingHi/SwingLo within the last 10 SwingHi's/SwingLo's; 
(2) EXTENDS each new TL to the right and SETS it's color and alert type; 
(3) TRUNCATES a DnTL/UpTL on the right when the next new DnTL/UpTL is drawn (if the 
   History input is set to "Yes"), or BarsPast bars after it has been breached, 
   whichever comes first.
(4) DELETES a DnTL/UpTL when the next new DnTL/UpTL is drawn, if the History input 
   is set to "No".

NOTE: This indicator may not work well with low-count tick bars, such as 10-tick bars, 
etc., because the time resolution of the bars may not be high enough for each bar to 
have a distinct time stamp.
}

inputs: 
SwHiStrength( 4 ), 
SwLoStrength( 4 ), 
BarsPast( 10 ), 
History( "Yes" ), 
DnTLColor( Red ), 
UpTLColor( Cyan ), 
AlertType( "IntraBar" ) ,

width(1); {<--- added line}

variables: 
DnTLRef( -1 ), 
DnTLEndBar( 0 ), 
DnTLBreak( false ), 
DnTLColorNum( DnTLColor ), 

UpTLRef( -1 ), 
UpTLEndBar( 0 ), 
UpTLBreak( false ), 
UpTLColorNum( UpTLColor ), 

Index( 0 ), 
BarNum( 0 ), 
HistoryTF( false ), 
AlertTypeCAPS( UpperStr( AlertType ) ) ;

arrays: 
SwHiDate[10]( 0 ), 
SwHiTime[10]( 0 ), 
SwHiVal[10]( -1000000 ), 
SwLoDate[10]( 0 ), 
SwLoTime[10]( 0 ), 
SwLoVal[10]( 1000000 ) ;

if CurrentBar = 1 then 
HistoryTF = UpperStr( History ) = "YES" or UpperStr( History ) = "Y" ;
{ should also be able to do this via declaration above }

BarNum = BarNumber ;

if SwingHighBar( 1, High, SwHiStrength, SwHiStrength + 1 ) = SwHiStrength then 
{ ie, if just confirmed SwHi }
begin

{ push arrays back }
for Value1 = 9 downto 0 
	begin
	SwHiDate[ Value1 + 1 ] = SwHiDate[Value1] ;
	SwHiTime[ Value1 + 1 ] = SwHiTime[Value1] ;
	SwHiVal[ Value1 + 1 ] = SwHiVal[Value1] ;
	end ;

{ read in parameters of new SwHi into 0-elements of arrays }
SwHiDate[0] = Date[swHiStrength] ;
SwHiTime[0] = Time[swHiStrength] ;
SwHiVal[0] = High[swHiStrength] ;

{ find and save the index of the next-most-recent higher SwHi if it exists }
for Value2 = 1 to 10 
	begin
	if SwHiVal[Value2] > SwHiVal[0] then 
		begin
		Index = Value2 ;
		Value2 = 11 ; { short circuit the looping with 11 instead of 10; the 11
		 will become 12 in the final pass }
		end ;
	end ;

if Value2 = 12 then { ie, if next-most-recent higher SwHi exists }
	begin
	if DnTLRef >= 0 then  { ie, if previous DnTL exists }
		begin
		if HistoryTF and DnTLBreak = false then 
			{ if history reqd and most recent DnTL not already truncated 
			  elsewhere, truncate it now }
			begin
			TL_SetEnd( DnTLRef, Date, Time, TL_GetValue( DnTLRef, Date, Time ) ) ;
			TL_SetExtRight( DnTLRef, false ) ;
			end
		else if HistoryTF = false then
			{ if history not reqd, delete most recent DnTL }
			TL_Delete( DnTLRef ) ;
		end ;
	{ draw new DnTL, reset break flag, save endbar, set extents/color/alert }
	DnTLRef = TL_New( SwHiDate[index], SwHiTime[index], SwHiVal[index], 
	 SwHiDate[0], SwHiTime[0], SwHiVal[0] ) ;

	TL_SetSize( DnTLRef, width ); {<--- added line}

	if DnTLBreak = true then 
		DnTLBreak = false ;
	DnTLEndBar = BarNum - SwHiStrength ;
	TL_SetExtLeft( DnTLRef, false ) ;
	TL_SetExtRight( DnTLRef, true ) ;
	if DnTLColorNum <> 99 then 
		TL_SetColor( DnTLRef, DnTLColorNum ) ;
	if AlertTypeCAPS = "ONCLOSE" then 
		TL_SetAlert( DnTLRef, 2 )
	else if AlertTypeCAPS = "INTRABAR" then 
		TL_SetAlert( DnTLRef, 1 )
	else
		TL_SetAlert( DnTLRef, 0 ) ;
	end ;
end ;

if SwingLowBar( 1, Low, SwLoStrength, SwLoStrength + 1 ) = SwLoStrength then 
{ ie, if just confirmed SwLo }
begin

{ push arrays back }
for Value1 = 9 downto 0 
	begin
	SwLoDate[Value1+1] = SwLoDate[Value1] ;
	SwLoTime[Value1+1] = SwLoTime[Value1] ;
	SwLoVal[Value1+1] = SwLoVal[Value1] ;
	end ;

{ read in parameters of new SwLo into 0-elements of arrays }
SwLoDate[0] = Date[swLoStrength] ;
SwLoTime[0] = Time[swLoStrength] ;
SwLoVal[0] = Low[swLoStrength] ;

{ find and save the index of the next-most-recent lower SwLo if it exists }
for Value2 = 1 to 10 
	begin
	if SwLoVal[Value2] < SwLoVal[0] then 
		begin
		Index = Value2 ;
		Value2 = 11 ;{ short circuit the looping with 11 instead of 10; the 11
		 will become 12 in the final pass }
		end ;
	end ;

if Value2 = 12 then  { ie, if next-most-recent lower SwLo exists }
	begin
	if UpTLRef >= 0 then { ie, if previous UpTL exists }
		begin
		if HistoryTF and UpTLBreak = false then 
			{ if history reqd and most recent UpTL not already truncated 
			  elsewhere, truncate it now }
			begin
			TL_SetEnd( UpTLRef, Date, Time, TL_GetValue( UpTLRef, Date, Time ) ) ;
			TL_SetExtRight( UpTLRef, false ) ;
			end
		else if HistoryTF = false then
			{ if history not reqd, delete most recent UpTL }
			TL_Delete( UpTLRef ) ;
		end ;
	{ draw new UpTL, reset break flag, save endbar, set extents/color/alert }
	UpTLRef = TL_New( SwLoDate[index], SwLoTime[index], SwLoVal[index], 
	 SwLoDate[0], SwLoTime[0], SwLoVal[0] ) ;

	TL_SetSize( UPTLRef, width ); {<--- added line}

	if UpTLBreak = true then
		UpTLBreak = false ;
	UpTLEndBar = BarNum - SwLoStrength ;
	TL_SetExtLeft( UpTLRef, false ) ;
	TL_SetExtRight( UpTLRef, true ) ;
	if UpTLColorNum <> 99 then 
		TL_SetColor( UpTLRef, UpTLColorNum ) ;
	if AlertTypeCAPS = "ONCLOSE" then 
		TL_SetAlert( UpTLRef, 2 )
	else if AlertTypeCAPS = "INTRABAR" then 
		TL_SetAlert( UpTLRef, 1 )
	else
		TL_SetAlert( UpTLRef, 0 ) ;
	end ;
end ;

{ if most recent DnTL/UpTL exists AND has not yet been truncated here AND was drawn 
 at least BarsPast ago AND was breached BarsPast bars ago THEN truncate it here and 
 set break flag }

if DnTLRef >= 0 
and DnTLBreak = false
and BarNum > DnTLEndBar + SwHiStrength + BarsPast 
and ( Close > TL_GetValue( DnTLRef, Date, Time ) )[barsPast]
then 
begin
TL_SetEnd( DnTLRef, Date, Time, TL_GetValue( DnTLRef, Date, Time ) ) ;
TL_SetExtRight( DnTLRef, false ) ;
DnTLBreak = true ;
end ;

if UpTLRef >= 0 
and UpTLBreak = false
and BarNum > UpTLEndBar + SwLoStrength + BarsPast 
and ( Close < TL_GetValue( UpTLRef, Date, Time ) )[barsPast]
then 
begin
TL_SetEnd( UpTLRef, Date, Time, TL_GetValue( UpTLRef, Date, Time ) ) ;
TL_SetExtRight( UpTLRef, false ) ;
UpTLBreak = true ;
end ;


{ ** Copyright (c) 1991-2003 TradeStation Technologies, Inc. All rights reserved. ** 
 ** TradeStation reserves the right to modify or overwrite this analysis technique 
    with each release. ** }

 

u are trying to sell something here

Share this post


Link to post
Share on other sites
...

What is the best way to accomplish this? I have tried - to write a formula comparing a new pivot to the previous 10, and adding a 2nd array that would store the relevant pivots. the 2nd method works OK, but requires the array to be cleared out each time a new value is added and I have no idea how to do that.

 

I appreciate any assistance on this and thanks in advance.

 

WT

 

this thread might help you on the array:

http://www.traderslaboratory.com/forums/f56/array-easylanguage-5785.html

 

 

14751d1257019257-array-easylanguage-2d_array.gif

 

14758d1257052126-array-easylanguage-array-address.jpg

Share this post


Link to post
Share on other sites
... the 2nd method works OK, but requires the array to be cleared out each time a new value is added and I have no idea how to do that.

...

 

try this idea:

 

// musical chair

if barstatus = 2 and condition1 = true then
begin
   arr[1,3] = arr[1,2];
   arr[1,2] = arr[1,1];
   arr[1,1] = variable1;
end;

Edited by Tams

Share this post


Link to post
Share on other sites

Here is a TradeStation help code example:

 

Variable: ID(-1);

If Low < Low[1] AND Close > High[1] Then Begin
 ID = TL_New(Date[1], Time[1], Low, Date, Time, Low);
 Value1 = TL_SetExtRight(ID, True);
End;

 

The above code adds multiple trendlines to my chart. Every time the conditions are met, a new trendline is added to the chart. Each trendline is extended all the way to the current right hand edge of the chart. The reserved word "TL_SetExtRight" causes the trendline to extend continuously from the starting point to the right.

 

So, this means that multiple trend lines can be created from one trendline variable. A trendline variable is not confined to only having one trendline.

Share this post


Link to post
Share on other sites

I add some code to label the line in the chart (from day 1 to day 4 from today ) but I find that some letters is missed after it is enabled. For example, d2H = day 2 high, it display d2 without H. After a while, it will show up all. Any idea?

 

 

===============================

 

input:

lookback( 4 ),

Line.size ( 1 ),

Line.style ( 2 ),

color.h1( blue ),

color.l1( blue ),

color.h2( red ),

color.l2( red ),

color.h3( darkgreen ),

color.l3( darkgreen ),

color.h4( cyan ),

color.l4( cyan ),

hori_txdisp(10); {horizontal distance}

 

vars: d1Htid(0), d1Ltid(0),

d2Htid(0), d2Ltid(0),

d3Htid(0), d3Ltid(0),

d4Htid(0), d4Ltid(0);

 

// 1

if date <> date[1] and lookback = 1 then begin

value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));

value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));

 

tl_setcolor( value1, color.h1 );

TL_SetSize( value1, Line.size );

TL_SetStyle( value1, Line.style );

 

tl_setcolor( value2 , color.l1 );

TL_SetSize( value2, Line.size );

TL_SetStyle( value2, Line.style );

end;

 

if lookback = 1 then begin

tl_setend_s(value1, d , time_s , highd(1) );

tl_setend_s(value2, d , time_s , lowd(1) );

end;

 

// 2

if date <> date[1] and lookback = 2 then begin

value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));

value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));

value3 = tl_new_s(d , time_s , highd(2), d , time_s, highd(2 ));

value4 = tl_new_s(d , time_s, lowd(2), d , time_s, lowd(2));

 

tl_setcolor( value1, color.h1 );

TL_SetSize( value1, Line.size );

TL_SetStyle( value1, Line.style );

 

tl_setcolor( value2 , color.l1 );

TL_SetSize( value2, Line.size );

TL_SetStyle( value2, Line.style );

 

tl_setcolor( value3, color.h2 );

TL_SetSize( value3, Line.size );

TL_SetStyle( value3, Line.style );

 

tl_setcolor( value4 , color.l2 );

TL_SetSize( value4, Line.size );

TL_SetStyle( value4, Line.style );

end;

if lookback = 2 then begin

tl_setend_s(value1, d , time_s , highd(1) );

tl_setend_s(value2, d , time_s , lowd(1) );

tl_setend_s(value3, d , time_s , highd(2) );

tl_setend_s(value4, d , time_s , lowd(2) );

end;

 

// 3

if date <> date[1] and lookback = 3 then begin

value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));

value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));

value3 = tl_new_s(d , time_s , highd(2), d , time_s, highd(2 ));

value4 = tl_new_s(d , time_s, lowd(2), d , time_s, lowd(2));

value5 = tl_new_s(d , time_s , highd(3), d , time_s, highd(3 ));

value6 = tl_new_s(d , time_s, lowd(3), d , time_s, lowd(3 ));

 

tl_setcolor( value1, color.h1 );

TL_SetSize( value1, Line.size );

TL_SetStyle( value1, Line.style );

 

tl_setcolor( value2 , color.l1 );

TL_SetSize( value2, Line.size );

TL_SetStyle( value2, Line.style );

 

tl_setcolor( value3, color.h2 );

TL_SetSize( value3, Line.size );

TL_SetStyle( value3, Line.style );

 

tl_setcolor( value4 , color.l2 );

TL_SetSize( value4, Line.size );

TL_SetStyle( value4, Line.style );

 

tl_setcolor( value5, color.h3 );

TL_SetSize( value5, Line.size );

TL_SetStyle( value5, Line.style );

 

tl_setcolor( value6 , color.l3 );

TL_SetSize( value6, Line.size );

TL_SetStyle( value6, Line.style );

end;

 

if lookback = 3 then

begin

tl_setend_s(value1, d , time_s , highd(1) );

tl_setend_s(value2, d , time_s , lowd(1) );

tl_setend_s(value3, d , time_s , highd(2) );

tl_setend_s(value4, d , time_s , lowd(2) );

tl_setend_s(value5, d , time_s , highd(3) );

tl_setend_s(value6, d , time_s , lowd(3) );

 

if lastbaronchart then

begin

tl_setextright(value1, true);

tl_setextright(value2, true);

tl_setextright(value3, true );

tl_setextright(value4, true);

tl_setextright(value5, true);

tl_setextright(value6, true);

end;

end;

 

 

// 4

if date <> date[1] and lookback = 4 then begin

value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));

value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));

value3 = tl_new_s(d , time_s , highd(2), d , time_s, highd(2 ));

value4 = tl_new_s(d , time_s, lowd(2), d , time_s, lowd(2));

value5 = tl_new_s(d , time_s , highd(3), d , time_s, highd(3 ));

value6 = tl_new_s(d , time_s, lowd(3), d , time_s, lowd(3 ));

value7 = tl_new_s(d , time_s , highd(4), d , time_s, highd(4 ));

value8 = tl_new_s(d , time_s, lowd(4), d , time_s, lowd(4 ));

 

tl_setcolor( value1, color.h1 );

TL_SetSize( value1, Line.size );

TL_SetStyle( value1, Line.style );

//piv1tid = Text_New(date, Minlist(Time + hori_txdisp, SessionEndTime(0, 1) + hori_txdisp), highd(1) - (textscale * MinMove/PriceScale), "d1H");

d1Htid = Text_New(date, currenttime+hori_txdisp , highd(1), "d1H");

 

tl_setcolor( value2 , color.l1 );

TL_SetSize( value2, Line.size );

TL_SetStyle( value2, Line.style );

d1Ltid = Text_New(date, currenttime+hori_txdisp, lowd(1) , "d1L");

 

tl_setcolor( value3, color.h2 );

TL_SetSize( value3, Line.size );

TL_SetStyle( value3, Line.style );

d2Htid = Text_New(date, currenttime+hori_txdisp , highd(2), "d2H");

 

tl_setcolor( value4 , color.l2 );

TL_SetSize( value4, Line.size );

TL_SetStyle( value4, Line.style );

d2Ltid = Text_New(date, currenttime+hori_txdisp, lowd(2) , "d2L");

 

tl_setcolor( value5, color.h3 );

TL_SetSize( value5, Line.size );

TL_SetStyle( value5, Line.style );

d3Htid = Text_New(date, currenttime+hori_txdisp , highd(3), "d3H");

 

tl_setcolor( value6 , color.l3 );

TL_SetSize( value6, Line.size );

TL_SetStyle( value6, Line.style );

d3Ltid = Text_New(date, currenttime+hori_txdisp, lowd(3) , "d3L");

 

tl_setcolor( value7, color.h4 );

TL_SetSize( value7, Line.size );

TL_SetStyle( value7, Line.style );

d4Htid = Text_New(date, currenttime+hori_txdisp , highd(4), "d4H");

 

tl_setcolor( value8 , color.l4 );

TL_SetSize( value8, Line.size );

TL_SetStyle( value8, Line.style );

d4Ltid = Text_New(date, currenttime+hori_txdisp, lowd(4) , "d4L");

end;

 

if lookback = 4 then begin

tl_setend_s(value1, d , time_s , highd(1) );

tl_setend_s(value2, d , time_s , lowd(1) );

tl_setend_s(value3, d , time_s , highd(2) );

tl_setend_s(value4, d , time_s , lowd(2) );

tl_setend_s(value5, d , time_s , highd(3) );

tl_setend_s(value6, d , time_s , lowd(3) );

tl_setend_s(value7, d , time_s , highd(4) );

tl_setend_s(value8, d , time_s , lowd(4) );

end;

1.thumb.png.0ffb4c79e1848d62e88f5013b1d5ec4b.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • also ... and barely on topic... Winners (always*) overpay. Buying the dips is a subscription to the belief that winners win by underpaying - when in actuality winners (inevitably/always*) win by overpaying... it’s amazing the percentage of traders who think winners win by underpaying ... “Winners (always*) overpay.” ...  One way to implement this ‘belief’ is to only reenter when prices have emphatically resumed the 'trend' .   (Fwiw, While “Winners (always*) overpay.” holds true in most endeavors (relationships, business, sports, etc...) - “Winners (always*) overpay.”  is especially true for auctions... continuous auctions included.)
    • re:  "Does it make sense to always buy the dips?  “Buy the dip.”  You hear this all the time in crypto investing trading speculation gambling. [zdo taking some liberties] It refers, of course, to buying more bitcoin (or digital assets) when they go down in price: when the price “dips.” Some people brag about “buying the dip," showing they know better than the crowd. Others “buy the dip” as an investment strategy: they’re getting a bargain. The problem is, buying the dip is a fallacy. You can’t buy the dip, because you can't see the total dip until much later. First, I’ll explain this in a way that will make it simple and obvious to you; then I’ll show you a better way of investing. You Only Know the Dip in Hindsight When people talk about “buying the dip,” what they’re really saying is, “I bought when the price was going down.” " ... example of a dip ... 
    • Date: 19th April 2024. Weekly Commodity Market Update: Oil Prices Correct and Supply Concerns Persist.   The ongoing developments in the Middle East sparked a wave of risk aversion and fueled supply concerns and investors headed for safety. Hopes for imminent rate cuts from the Federal Reserve diminish while attention is now turning towards the demand outlook. The Gold price hit a high of $2417.89 per ounce overnight. Sentiment has already calmed down again and bullion is trading at $2376.50 per ounce as haven flows ease. Oil prices initially moved higher as concern over escalating tensions with the WTI contract hit a session high of $85.508 per barrel overnight, before correcting to currently $81.45 per barrel. Oil Prices Under Pressure Amid Middle East Tensions Last week, commodity indexes showed little movement, with Oil prices undergoing a slight correction. Meanwhile, Gold reached yet another record high, mirroring the upward trend in cocoa prices. Once again today, USOil prices experienced a correction and has remained under pressure, retesting the 50-day EMA at $81.00 as we moving into the weekend. Hence, despite the Israel’s retaliatory strike on Iran, sentiments stabilized following reports suggesting a measured response aimed at avoiding further escalation. Brent crude futures witnessed a more than 4% leap, driven by concerns over potential disruptions to oil supplies in the Middle East, only to subsequently erase all gains. Similarly with USOIL, UKOIL hovers just below $87 per barrel, marginally below Thursday’s closing figures. Nevertheless, volatility is expected to continue in the market as several potential risks loom:   Disruption to the Strait of Hormuz: The possibility of Iran disrupting navigation through the vital shipping lane, is still in play. The Strait of Hormuz serves as the Persian Gulf’s primary route to international waters, with approximately 21 million barrels of oil passing through daily. Recent events, including Iran’s seizure of an Israel-linked container ship, underscore the geopolitical sensitivity of the region. Tougher Sanctions on Iran: Analysts speculate that the US may impose stricter sanctions on Iranian oil exports or intensify enforcement of existing restrictions. With global oil consumption reaching 102 million barrels per day, Iran’s production of 3.3 million barrels remains significant. Recent actions targeting Venezuelan oil highlight the potential for increased pressure on Iranian exports. OPEC Output Increases: Despite the desire for higher prices, OPEC members such as Saudi Arabia and Russia have constrained output in recent years. However, sustained crude prices above $100 per barrel could prompt concerns about demand and incentivize increased production. The OPEC may opt to boost oil output should tensions escalate further and prices surge. Ukraine Conflict: Amidst the focus on the Middle East, markets overlooking Russia’s actions in Ukraine. Potential retaliatory strikes by Kyiv on Russian oil infrastructure could impact exports, adding further complexity to global oil markets.   Technical Analysis USOIL is marking one of the steepest weekly declines witnessed this year after a brief period of consolidation. The breach below the pivotal support level of 84.00, coupled with the descent below the mid of the 4-month upchannel, signals a possible shift in market sentiment towards a bearish trend reversal. Adding to the bearish outlook are indications such as the downward slope in the RSI. However, the asset still hold above the 50-day EMA which coincides also with the mid of last year’s downleg, with key support zone at $80.00-$81.00. If it breaks this support zone, the focus may shift towards the 200-day EMA and 38.2% Fib. level at $77.60-$79.00. Conversely, a rejection of the $81 level and an upside potential could see the price returning back to $84.00. A break of the latter could trigger the attention back to the December’s resistance, situated around $86.60. A breakthrough above this level could ignite a stronger rally towards the $89.20-$90.00 zone. Always trade with strict risk management. Your capital is the single most important aspect of your trading business. Please note that times displayed based on local time zone and are from time of writing this report. Click HERE to access the full HFM Economic calendar. Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Michalis Efthymiou Market Analyst HMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past perfrmance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • Date: 18th April 2024. Market News – Stock markets benefit from Dollar correction. Economic Indicators & Central Banks:   Technical buying, bargain hunting, and risk aversion helped Treasuries rally and unwind recent losses. Yields dropped from the recent 2024 highs. Asian stock markets strengthened, as the US Dollar corrected in the wake of comments from Japan’s currency chief Masato Kanda, who said G7 countries continue to stress that excessive swings and disorderly moves in the foreign exchange market were harmful for economies. US Stockpiles expanded to 10-month high. The data overshadowed the impact of geopolitical tensions in the Middle East as traders await Israel’s response to Iran’s unprecedented recent attack. President Joe Biden called for higher tariffs on imports of Chinese steel and aluminum.   Financial Markets Performance:   The USDIndex stumbled, falling to 105.66 at the end of the day from the intraday high of 106.48. It lost ground against most of its G10 peers. There wasn’t much on the calendar to provide new direction. USDJPY lows retesting the 154 bottom! NOT an intervention yet. BoJ/MoF USDJPY intervention happens when there is more than 100+ pip move in seconds, not 50 pips. USOIL slumped by 3% near $82, as US crude inventories rose by 2.7 million barrels last week, hitting the highest level since last June, while gauges of fuel demand declined. Gold strengthened as the dollar weakened and bullion is trading at $2378.44 per ounce. Market Trends:   Wall Street closed in the red after opening with small corrective gains. The NASDAQ underperformed, slumping -1.15%, with the S&P500 -0.58% lower, while the Dow lost -0.12. The Nikkei closed 0.2% higher, the Hang Seng gained more than 1. European and US futures are finding buyers. A gauge of global chip stocks and AI bellwether Nvidia Corp. have both fallen into a technical correction. The TMSC reported its first profit rise in a year, after strong AI demand revived growth at the world’s biggest contract chipmaker. The main chipmaker to Apple Inc. and Nvidia Corp. recorded a 9% rise in net income, beating estimates. Always trade with strict risk management. Your capital is the single most important aspect of your trading business. Please note that times displayed based on local time zone and are from time of writing this report. Click HERE to access the full HFM Economic calendar. Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Andria Pichidi Market Analyst HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • Date: 17th April 2024. Market News – Appetite for risk-taking remains weak. Economic Indicators & Central Banks:   Stocks, Treasury yields and US Dollar stay firmed. Fed Chair Powell added to the recent sell off. His slightly more hawkish tone further priced out chances for any imminent action and the timing of a cut was pushed out further. He suggested if higher inflation does persist, the Fed will hold rates steady “for as long as needed.” Implied Fed Fund: There remains no real chance for a move on May 1 and at their intraday highs the June implied funds rate future showed only 5 bps, while July reflected only 10 bps. And a full 25 bps was not priced in until November, with 38 bps in cuts seen for 2024. US & EU Economies Diverging: Lagarde says ECB is moving toward rate cuts – if there are no major shocks. UK March CPI inflation falls less than expected. Output price inflation has started to nudge higher, despite another decline in input prices. Together with yesterday’s higher than expected wage numbers, the data will add to the arguments of the hawks at the BoE, which remain very reluctant to contemplate rate cuts. Canada CPI rose 0.6% in March, double the 0.3% February increase BUT core eased. The doors are still open for a possible cut at the next BoC meeting on June 5. IMF revised up its global growth forecast for 2024 with inflation easing, in its new World Economic Outlook. This is consistent with a global soft landing, according to the report. Financial Markets Performance:   USDJPY also inched up to 154.67 on expectations the BoJ will remain accommodative and as the market challenges a perceived 155 red line for MoF intervention. USOIL prices slipped -0.15% to $84.20 per barrel. Gold rose 0.24% to $2389.11 per ounce, a new record closing high as geopolitical risks overshadowed the impacts of rising rates and the stronger dollar. Market Trends:   Wall Street waffled either side of unchanged on the day amid dimming rate cut potential, rising yields, and earnings. The major indexes closed mixed with the Dow up 0.17%, while the S&P500 and NASDAQ lost -0.21% and -0.12%, respectively. Asian stock markets mostly corrected again, with Japanese bourses underperforming and the Nikkei down -1.3%. Mainland China bourses were a notable exception and the CSI 300 rallied 1.4%, but the MSCI Asia Pacific index came close to erasing the gains for this year. Always trade with strict risk management. Your capital is the single most important aspect of your trading business. Please note that times displayed based on local time zone and are from time of writing this report. Click HERE to access the full HFM Economic calendar. Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Andria Pichidi Market Analyst HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.vvvvvvv
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.