Auto Draw Vertical Line based on Time?  [SOLVED]

Questions about MultiCharts and user contributed studies.
imoneyfish
Posts: 38
Joined: 26 Oct 2011
Has thanked: 6 times
Been thanked: 2 times

Auto Draw Vertical Line based on Time?

Postby imoneyfish » 24 Aug 2012

Hi everyone,

Anyone can help me with code of autodraw vertical line in 1 minute chart? like every 5 mins and 15 mins past the hour draw vertical time line. See on chart. Thanks a lot.
Attachments
1.jpg
(88.29 KiB) Downloaded 1934 times

User avatar
TJ
Posts: 7739
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1032 times
Been thanked: 2221 times

Re: Auto Draw Vertical Line based on Time?  [SOLVED]

Postby TJ » 24 Aug 2012

Hi everyone,

Anyone can help me with code of autodraw vertical line in 1 minute chart? like every 5 mins and 15 mins past the hour draw vertical time line. See on chart. Thanks a lot.
give this a try
Attachments
draw.line.txt
(364 Bytes) Downloaded 1152 times

imoneyfish
Posts: 38
Joined: 26 Oct 2011
Has thanked: 6 times
Been thanked: 2 times

Re: Auto Draw Vertical Line based on Time?

Postby imoneyfish » 27 Aug 2012

Hi everyone,

Anyone can help me with code of autodraw vertical line in 1 minute chart? like every 5 mins and 15 mins past the hour draw vertical time line. See on chart. Thanks a lot.
give this a try

Hi TJ,

in your code, the drawing is always on subchart, when i drag the indicator to main chart, i can't set the right scale. Could you help me further with the scale please? in EURUSD Chart, the code only draw line less than half of the screen. I think the problem is with top = h[1]*4 this line. How can I get all line full scale high please? Cheers

User avatar
TJ
Posts: 7739
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1032 times
Been thanked: 2221 times

Re: Auto Draw Vertical Line based on Time?

Postby TJ » 27 Aug 2012

Hi everyone,
Anyone can help me with code of autodraw vertical line in 1 minute chart? like every 5 mins and 15 mins past the hour draw vertical time line. See on chart. Thanks a lot.
give this a try
Hi TJ,
in your code, the drawing is always on subchart,
Format Study > Properties > Subchart

https://www.multicharts.com/trading-sof ... r_Settings

when i drag the indicator to main chart, i can't set the right scale. Could you help me further with the scale please? in EURUSD Chart, the code only draw line less than half of the screen. I think the problem is with top = h[1]*4 this line. How can I get all line full scale high please? Cheers
Format Study > Scaling > Scaling Range > Same as Instrument

https://www.multicharts.com/trading-sof ... or_Scaling

imoneyfish
Posts: 38
Joined: 26 Oct 2011
Has thanked: 6 times
Been thanked: 2 times

Re: Auto Draw Vertical Line based on Time?

Postby imoneyfish » 27 Aug 2012

Format Study > Scaling > Scaling Range > Same as Instrument

https://www.multicharts.com/trading-sof ... or_Scaling

I tried the scaling options already. Non of them works. the indicator calculation is 5. something need to be fix in the code " top=h[1]*4 " i recon, i just don't know how. Thanks again.

User avatar
piranhaxp
Posts: 241
Joined: 18 Oct 2005
Has thanked: 4 times
Been thanked: 30 times

Re: Auto Draw Vertical Line based on Time?

Postby piranhaxp » 04 Sep 2012

May this is more helpful for you. But please be aware it's not a plot-indicator. It generates trendlines as per defined.

Code: Select all

// BEGIN
//
// This indicator sets vertical trendlines (NO PLOTS !!!) when the time is at 5 min or 15 min of the hour
//
//
//
// ------------------------------------------------------------------------------------------
//
input: style(3); // ( 1 = solid, 2 = dashed, 3 = dotted ... etc etc )
input: color(lightGray); // color of the trendline
//
// ------------------------------------------------------------------------------------------
//
var: drawline(false);
var: tl(-1);
//
// ------------------------------------------------------------------------------------------
//
drawline = (fracPortion(time/100)=0.05) or (fracPortion(time/100)=0.15); // define TRUE for drawline
//
If drawline then
begin
if bartype <> 0 then // bartype <> 0 ... just working in minute charts
begin
// set the trendline
tl = tl_new(date,time[1], l, date, time[1], h);
tl_setcolor(tl, color); // 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)
end;
end;
//
// ------------------------------------------------------------------------------------------
//
// END
Hope it helps.

Mike


Return to “MultiCharts”