help with vert TrendLine/Timeline coding question  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
BB123
Posts: 68
Joined: 24 Nov 2023
Has thanked: 22 times
Been thanked: 10 times

help with vert TrendLine/Timeline coding question

Postby BB123 » 29 Nov 2023

Trying to figure out how to place a single vertical line on each bar starting from the data playback point i pick.

Im running into 2 problems:
1. When i place the study on the chart - it automatically goes back and fills in all the previous bars.. Id like to just start from where i pulled the data playback to.

2. Though it should be placing a line on each bar-- it doesnt..

This was done using TrendLines... Cause i cant find a way to code a TimeLine..

Code: Select all

vars:prev_bar_num(0.0); if(CurrentBar > prev_bar_num) then begin prev_bar_num = CurrentBar; if open > close then TL_New(d,t,0,d,t,9000); if open < close then TL_New(d,t,0,d,t,9000); end;

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: help with vert TrendLine/Timeline coding question

Postby TJ » 04 Dec 2023

Trying to figure out how to place a single vertical line on each bar starting from the data playback point i pick.

You need to elaborate on your thoughts. This ONE-LINE can be interpreted in many ways.
Please draw a diagram to illustrate your view.
Please give some examples with different scenarios.

User avatar
BB123
Posts: 68
Joined: 24 Nov 2023
Has thanked: 22 times
Been thanked: 10 times

Re: help with vert TrendLine/Timeline coding question

Postby BB123 » 11 Dec 2023

Hi TJ Thanks for taking your time out to help.. I really appreciate it..

I think my original question was a bit confusing.. I kind of asked two questions into one.. So ill just start with one part for now.. (forget the above question)..


1. How can i put a signal/script onto the chart and only run the script into the future as new candles are created? Right now i put a signal onto the chart and multicharts automatically goes back and checks all the old candles/boxes for old trades and setups... I dont want multicharts to do that.. I want to put the signal on the chart and ONLY run the script forward ..

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: help with vert TrendLine/Timeline coding question

Postby TJ » 12 Dec 2023

LastBarOnChart (Function)

The LastBarOnChart function is used to determine if the current bar being evaluated is the last bar on the chart.

Syntax
LastBarOnChart

Returns (Boolean)
True if LastBarOnChart is the last charted bar. False if not.

Parameters
None

Example
In order to play a wave (sound) file only in the last bar of the chart you can write:

If LastBarOnChart Then
Condition1 = PlaySound("C:\window\ding.wav");

This function will return True for all bars on a chart with tick-based interval, which have the same date and time as the last bar of the chart.

User avatar
BB123
Posts: 68
Joined: 24 Nov 2023
Has thanked: 22 times
Been thanked: 10 times

Re: help with vert TrendLine/Timeline coding question  [SOLVED]

Postby BB123 » 12 Dec 2023

TJ TJ TJ TJ TJ .... That was IT...

Thank You!!!!!...


Return to “MultiCharts”