Page 6 of 6

Re: Auto Trend Lines

PostPosted: Sun Aug 06, 2017 5:04 am
by Apprentice
Affirmative.
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:

CSV_File2_UP.Line3
CSV_File2_UP.Line7
CSV_File2_UP.Line1
CSV_File1_DOWN.Line10
CSV_File3_UP.Line4
CSV_File3_DOWN.Line2

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.