Advanced - Loading Lines and Text into Paintbar from a File

This is a pretty specialized piece feature that we put in because a user asked for it.
The user wanted to prepare a file that contained information about several straight lines he wanted drawn on the chart, then wanted to be able to load it into a chart.
The paintbar code itself cannot do any file accesses, for security reasons. That is why for this purpose we added a function that you can call.
public void SetLinesFromFile(string FileName)
The FileName is a full path to a text file that contains the lines to be loaded.

NOTE: this function does a file access, which, if done on EVERY iteration of a paintbar calculation, would seriously slow things down. Thus we suggest that:


You call this function ONLY if IsLastCandle flag is true.

If you want to do this more than once, do it maybe every minute or so, not all the time.


The format of the text file:  comma-separated text, containing following fields:


number - a unique identifier for the line


string - the line's color. Has to be one of the NAMED colors

Anchor 1 Timestamp

DateTime - the UTC datetime stamp of the 1st anchor of the line. Example: "11/17/2021 17:00:23"

Anchor 1 Price

number - the price Y coordinate of the first anchor of the line

Anchor 2 Timestamp

DateTime - the UTC datetime stamp of the 2nd anchor of the line. Example: "11/17/2021 18:12:12"

Anchor 2 Price

number -  the price Y coordinate of the first anchor of the line


[optional] number (int) - width of the line, in pixels


[optional] string - the text with which the line is annotated. Make sure it is in double quotes.


[optional] string - where on the line the text goes. Could be:
OnLeft, OnRight, LeftAbove, CenterAbove, RightAbove, LeftBelow, CenterBelow, RightBelow


[optional] number - font size multiplier. If set to 1, the text will be same size as other text on the chart. 0.5 would make it half as big, etc.



Example contents of a text file:
2, White, 11/17/2021 17:00, 1070, 11/17/2021 19:00, 1080

3, Red, 11/17/2021 19:30:15, 1072.23, 11/17/2021 19:45, 1072.23, 2, "Res", CenterAbove, 1