NexusFi: Find Your Edge


Home Menu

 





How to code an angled trend line???


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one Sinatra Fan with 5 posts (0 thanks)
    2. looks_two ABCTG with 4 posts (0 thanks)
    3. looks_3 DoubleDown with 1 posts (0 thanks)
    4. looks_4 trendisyourfriend with 1 posts (0 thanks)
    1. trending_up 681 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 10 posts
    2. attach_file 1 attachments




 
Search this Thread

How to code an angled trend line???

  #11 (permalink)
DoubleDown
Bend, Oregon
 
Posts: 1 since Nov 2023
Thanks Given: 1
Thanks Received: 0

Hi Sinatra Fan...

One thing to note for multicharts is.. When you put something on the chart-- MC goes back to the start of the data and works its way through--- so that is why you saw the big cpu hit.. One thing you can do is use the start time/date as a point.. So if date > then start time/date then draw the line.. This way It should just place the one line on the chart at that point.. Just know that once it signal/indicator goes through that first run-- it will then only be working on the most current bar/candle.. So you shouldnt have the cpu hit you did the first time you ran it..

Here is a example of a trendline i use as a time line(vertical line).. Cause Multicharts is dumb and dont have a simple VertTimeLine indicator.
 
Code
if 'an event happens" then begin
StartTime = Time; EndTime = Time;
	
				tl = tl_new(date,StartTime, l, date, EndTime, h);
				tl_setcolor(tl, green);	// set trendline color from input
				tl_setstyle(tl, style);	// set trendline style from input
				tl_setextleft(tl, true);	// set trendline extension to left true (for HIGH)
				tl_setextright(tl, true);	// set trendline extension to right true (for LOW)
				drawlineGreen = false;
				drawlineRed = true; 

		end;

Here is a conditions that can signal the trade if the the line is crossed(though i just pulled this from the signal that came with MC called TrendLine LE (for long entry));
 
Code
condition1 = High < TL_GetValue( tl , Date, Time[1] ) ;
condition2= High >TL_GetValue( tl , Date, Time) ;
if condition1 and condition2 then
	Buy next bar at TL_GetValue( tl , Date next bar, Time next bar ) stop ;

tl_new spits out the item number for your new line to the tl variable.. So that is why youll see it used all through the set code..

With this said.. the only reason i chimed in was cause i have been working to get a verttimeline and went through what your going through.. ABCTG is who you should listen to.. Im new with Multicharts and struggling to figure out some of the most basic things.. I code in mql4 great-- but powerlanguage is new to me.. and multicharts documentation SUCKS ASS!!!..

I am questioning if i should have even posted cause i dont want to confuse the situation.. But if you get anything out of this then great.. If not-- then you can flip off the screen and just ignore ..
Hope it helps

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
 




Last Updated on December 3, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts