Hello
I'm seeking info to resolve my interrogation
I want to draw small square using trend line in the right margin ( free space) on the workspace.
My question how to determine the date and time value for the left part of the square. I got the right value using the getappinfo
Martin
Drawing trend line in the right margin [SOLVED]
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Drawing trend line in the right margin
Count the bars...Hello
I'm seeking info to resolve my interrogation
I want to draw small square using trend line in the right margin ( free space) on the workspace.
My question how to determine the date and time value for the left part of the square. I got the right value using the getappinfo
Martin
how many bars do you want to offset from the right margin?
then deduct 5 min from each number of bars, and you will have your left-side time coordinate.
(5 min per bar being your chart example)
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Drawing trend line in the right margin
I thought about using Symbol_Time_s, but this did not work. However, you can calculate with DateTime (see the small red arrow):My question how to determine the date and time value for the left part of the square. I got the right value using the getappinfo
Code: Select all
Variables:
timePerBarMinutes(0),
futureBarTime(0),
oneMinute(ELTimeToDateTime(1));
if (LastBarOnChart_s = true) and (BarStatus(1) = 2) then begin
// Number of minutes each price bar has (assuming minute chart)
timePerBarMinutes = BarInterval;
// Calculating the future bar time.
// Multiplied by 10, so if you have a chart shift of 20 bars, the arrow
// will be halfway.
futureBarTime = ELTimeToDateTime_s(Time_s) +
((timePerBarMinutes * 10) * oneMinute) +
ELDateToDateTime(Date);
// Now we can plot
value1 = Arw_New_s(
JulianToDate(futureBarTime),
DateTime2ELTime_s(futureBarTime),
Close,
True);
end; //: LastBarOnChart
- Attachments
-
- scr.15-03-2014 07.17.01.png
- (9.27 KiB) Downloaded 391 times
Resolve: Drawing trend line in the right margin [SOLVED]
THanks TC / Josh
The solution was to use the new function TL_SetBegin_BN. This one use the bar number instead of date and time as reference.
Martin
The solution was to use the new function TL_SetBegin_BN. This one use the bar number instead of date and time as reference.
Code: Select all
R_Space = getappinfo(aiSpaceToRight); //Read the margin space
If R_Space <> 0 then R_Space = r_Space /2; // Use half of the space . R_Space now hold the number of bars in the margin / 2
//To draw a vertical line
If LasBaronchart then begin
TL_SetBegin_BN (LeftLine, BarNumber + R_Space, R_Highest ) ;
TL_SetBegin_BN (LeftLine, BarNumber + R_Space, R_LOwest ) ;
end;