Trendline_LE strategy modification

Questions about MultiCharts and user contributed studies.
designer01
Posts: 80
Joined: 02 Feb 2010

Trendline_LE strategy modification

Postby designer01 » 27 Aug 2011

The Multicharts standard strategy "Trendline_LE" is intended to set a BUY order when the PRICE crosses above a manually drawn Trendline in the price chart.

My question is ... Can this strategy "Trendline_LE" be modified so instead of PRICE crossing the Trendline, I want an indicator like CCI crossing the manually drawn Trendline to send the BUY order.

This could be either in the main chart panel or in a subgraph panel which ever one is possible.

Please let me know if it is at all possible and if you can modify it or at least direct me to a similar example so I can figure it out.
Thanks

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Trendline_LE strategy modification

Postby bowlesj3 » 27 Aug 2011

I do not use trend lines any more for trend line breaks (except with the RSI sometimes in which case I do it manually). So I am not sure about having the trend line armed for crossovers other than price. However, I have calculated the constant extension of a trend line to current price by calculating the per bar change of the trend line. This way you always know the current bar value of the trend line and you can have your program detect any form of cross over as you constantly extend your trend line at each bars end. It works great. To do this I use the Move Trend Line functions mentioned below so that the last anchor point is always the current bar.

to create trend lines under program control

for subcharts you need to use the tl_new_self command for 1 minute bars or up. Use tl_new_self_s for seconds bars such as 10 second or 5 second.

For the main chart you can use tl_new and tl_new_s.

You need to get the scaling of subcharts correct or you will not see the trend line. It took me a while to figure this one out. There is a thread about this. I think a search for tl_new_self or tl_new_self_s will find it. Here it is.
viewtopic.php?f=1&t=6769&hilit=TL_new_self


Once you have them out there you can use two functions I wrote called A_MoveTrendLine and A_MoveTrendLine_s to make moving them a lot less confusing. If doing this under program control, If you can, it is a lot better to create the line at the first bar and hide it then move it when you need it. Constantly creating and deleting lines can cause problems.
Here is the thread where those move functions can be found.
viewtopic.php?f=5&t=7748&hilit=movetrendline

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Trendline_LE strategy modification

Postby Dave Masalov » 29 Aug 2011

designer01,

This can be done by means of Power Language. Trendline_LE is basically the main example of such code. It is not a 5 minute deal to code such strategy, so if you are interested in custom programming project please contact us directly.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Trendline_LE strategy modification

Postby bowlesj3 » 30 Aug 2011

I guess I should have mentioned that my bar by bar rate of change in the line coding was not meant to detect trend line breaks. It was rather used to create a parallel line to get a bar by bar accurate time and distance measure of forward stall in a series of waves moving up/down such that I could measure one wave against the prior wave. The code determines if the parallel line is off the end of prices or not and if it is then it has to extend it bar by bar using the same bar by bar rate of change as the original line. So using this technique you can do a lot more with lines than just a simple break indicator.


Return to “MultiCharts”