Page 6 of 9

Re: Auto Trend Lines

PostPosted: Sun Aug 06, 2017 5:04 am
by Apprentice
We've detected the bug.
Will fix it as soon as possible.

Re: Auto Trend Lines

PostPosted: Mon Aug 07, 2017 12:38 pm
by Apprentice
Try it now.

Re: Auto Trend Lines

PostPosted: Mon Aug 07, 2017 6:57 pm
by Cactus
It is great now thanks, works as advertised
Funny I figured it out on my own too earlier but your code is of course much healthier and more clear to read.
Very useful trendlines can be drawn with this
If you provide a good .csv file with the levels (fractals) or zigzag peaks and valleys

Do you think this can be turned to have output streams for each line, to use in a strategy?
Is it doable to create a sample strategy, with user choice .csv file input. To draw the lines and use their output streams of the latest bar?
Then for example "sell" when (price[1] < stream and price[0] >= stream)
in brackets[] is period

Re: Auto Trend Lines

PostPosted: Tue Aug 08, 2017 2:36 am
by Apprentice
Strategy that will trade if price cross line defined by .csv file?

Re: Auto Trend Lines

PostPosted: Tue Aug 08, 2017 3:51 pm
by Cactus
Apprentice wrote:Strategy that will trade if price cross line defined by .csv file?

Yes, exactly. Cross line just as an example.
I think this is a highly valuable indicator. At the moment the lines drawn with this CSV file indicator are for visual purpose only so manual trading.

So in case of a strategy, if the .csv file parameter can be passed on (can be just hard coded path in the code that user can edit), then lines be drawn on the data from the file, but with output streams generated for each line separately (I know if there is a lot of lines it might be slow because of this). If each of the lines had a independent output stream(only most recent/current candle matters), it would make it possible to code strategy logic around it.

For example. Have 100 lines drawn, outputs named line1, line2, line3... etc.
One strategy could be to detect clusters (when many lines meet), for a higher chance of price bouncing off it like off support resistance, or breaking through it.

Example logic: (IF (candle OPEN < line4, line8, line34) AND (tick >= line4, line8, line34) THEN sell)
line4, line8, line34 are just example of output streams, could be any lines

Or even better, just have a counter (+1) whenever price cross a line. But minus 1 if it falls below it again (observe ticks), based on x timeframe candle. Then introduce logic IF counter is high (for example 10+) then it's a higher chance of encountering support/resistance made by drawn lines because it is 10 at once in one place, so strategy can take some action by looking at counter which would be equivalent to price touching all 10 lines

Hope this make sense.

For this they would need to be extended infinitely not just maximum 100 bars

Re: Auto Trend Lines

PostPosted: Wed Aug 09, 2017 3:08 am
by Apprentice
Will we define the lines from one or several files?

Re: Auto Trend Lines

PostPosted: Wed Aug 09, 2017 4:31 pm
by Cactus
Apprentice wrote:Will we define the lines from one or several files?

Great idea Apprentice!
I have one too (at end of this post)...

Yes, I think the possibility to include at least two files in the same strategy would be beneficial, for example:
You can define csv file data for valleys ( v ) and peak ( ^ ) separately. ("UP_CSV1", "DOWN_CSV1")
Then strategy can treat those lines differently (to follow trend for example, not go against it)

If it can be possible to include any amount of files that would be superb!

With more than 2+ files, one idea could be to play around and define the "strength" of the lines.
For example, plotting lines on a zigzag from weekly timeframe would carry greater strength than those of a the same zigzag but from daily timeframe. In this way major trendlines and minor trendlines can be detected (And strategy can then be edited to recognize it by output streams, and act accordingly)

So a scenario like this. With 6 files in a strategy, each with 10 rows (for 10 line outputs):

1. CSV_File1_UP
2. CSV_File1_DOWN
3. CSV_File2_UP
4. CSV_File2_DOWN
5. CSV_File3_UP
6. CSV_File3_DOWN

Files 1 and 2 can be a line drawn on "daily" timeframe data and carry strength of "1"
Files 3 and 4 can be for "weekly", strength "2"
Files 5 and 6 can be "monthly" with greatest strength "3"

Don't actually worry about the "strength" I am talking about, this is not part of strategy I request as this logic can be written by the user, just my idea for reason on how to utilize more than 1 file nicely.

So with those 6 files you will have output streams like:


Etc, etc... I hope this make sense so far

If this is a good solution, great. But if adding so many files in one strategy creates a performance issue, perhaps a additional parameter could be added at end of line, to specify if the line is treated as DOWN or UP (this is decided by user, don't worry about slope or line starting position points). This way you can define both up and down lines in same file, but their output streams will be respected according to the up or down flag. And also a "priority" [OPTIONAL] number at the very end to account for the different output stream user wants for example to count the strength of the lines according where they from. So inside file would look like this:
Code: Select all
06/30/2017 00:42,84.3165,06/30/2017 05:24,85.8775,UP,"3"
06/30/2017 00:42,84.3165,06/30/2017 06:15,86.0485,DOWN,"1"
06/30/2017 00:42,84.3165,06/30/2017 06:48,86.0225,UP,"1"
06/30/2017 00:42,84.3165,06/30/2017 07:31,86.0525,DOWN,"2"

The "UP" and "DOWN" will be used to draw the lines differently (red or green). But in an actual strategy you wouldn't see the lines since it is not an indicator so color makes no sense of course. Just different output streams names.

So what I mean is, the goal is to have individual output streams for the lines to not treat them all the same, that's the idea, if this can be defined in one file with additional parameters like "UP/DOWN" and priority number that's great, if it is better done with many files that is good too.

If my long post is unclear I will be happy to explain this further and contribute with code development myself

Re: Auto Trend Lines

PostPosted: Sun Aug 13, 2017 2:47 am
by Apprentice
Your request is added to the development list, Under Id Number 3847
If someone is interested to do this task, please contact me.

Re: Auto Trend Lines

PostPosted: Tue Sep 05, 2017 4:22 am
by Apprentice
Try this version.
CSV Lines Helper Tool_streams.lua
(5.04 KiB) Downloaded 912 times

(1.96 KiB) Downloaded 922 times

Re: Auto Trend Lines

PostPosted: Tue Sep 05, 2017 4:11 pm
by Cactus
Thank you for your efforts. Unfortunately it doesn't work for me (on historical data)
Consider this data:

Code: Select all
06/26/2017 22:28,84.818,06/26/2017 23:33,84.944,
06/27/2017 00:30,85.001,06/27/2017 00:38,84.9765,
06/27/2017 01:00,84.9325,06/27/2017 01:21,84.9355,
06/27/2017 01:40,84.9495,06/27/2017 02:09,84.846,
06/27/2017 03:01,84.9025,06/27/2017 03:14,84.932,
06/27/2017 03:31,84.9715,06/27/2017 04:02,84.942,
06/27/2017 04:26,84.853,06/27/2017 04:47,84.879,
06/27/2017 06:19,84.9355,06/27/2017 06:49,84.9745,

Code: Select all
06/27/2017 21:33,85.2355,06/27/2017 21:45,85.236,
06/27/2017 22:34,85.241,06/27/2017 23:00,85.1985,
06/27/2017 23:36,85.2235,06/27/2017 23:57,85.2235,
06/28/2017 00:29,85.229,06/28/2017 00:53,85.2125,
06/28/2017 01:43,85.3005,06/28/2017 01:59,85.3385,
06/28/2017 02:32,85.4015,06/28/2017 03:12,85.2465,
06/28/2017 03:49,85.1185,06/28/2017 04:12,84.911,

Then go to AUD/JPY historical m1 timeframe data from 06/26/2017 22:28 to 06/28/2017 04:12 (My chart is set to New York timezone) Nothing is drawn on chart, and indicator gives no error. But this is not big deal. I notice it is because this is historical data. With more recent data it works and draws the lines, and I hope it will continue to

For example, this data works:
Code: Select all
09/04/2017 21:33,85.2355,09/04/2017 21:45,85.236,
09/04/2017 22:34,85.241,09/04/2017 23:00,85.1985,
09/04/2017 23:36,85.2235,09/04/2017 23:57,85.2235,
09/05/2017 00:29,85.229,09/05/2017 00:53,85.2125,

Thank you. I will probably not make any more requests for the time being and will try to put a system together in the coming weeks. When something fruitful comes out of it I will share it on this forum as you all have been tremendous help