PureBytes Links
Trading Reference Links
|
Hello all
Further to my post - the issue of the traling stop not working as the author in S & C article intended is that TJ's solution does not take into consideration the date (ie in the code below: dt = ParamDate("Date of the trend", "2008-11-20" ); " & intial stop (Value3 = Param("Initial Stop", 19, 0, 1e6 ); " to calculate the start of the TL and achor it there (trailing stop)then plot from there on.
It seems that by overlooking that point the plot starts at the start of the array ignoring input data. What I think is required to fix that issue is some way of extracting the array element index [i] on the start date (dt[i] == input date and intializing TL with intial stop ie TL[i] =value3;
I cannot see any way of extracting the [i].
Anyone have thoughts on how this can be fixed or a better way of approaching the solution.
I have a comparison with the indicator applied in Metastock with Amibroker screenshots on the same stock - if I can workout how to add attachments to this post for anyone interested.
Any input pointing me in some drection to a solution is much appreciated.
Thanks
Ed
--- In amibroker@xxxxxxxxxxxxxxx, "edwol53" <edwol@xxx> wrote:
>
> Hello all
>
> I am looking at the code that TJ provided in AmiBroker S&C Traders' Tips monthly. Issue 1/2008.
>
> I have applied it to some charts and it seems that the trailing stop "TL" in the code which appears to be correct does not plot as shown in the example. I get a horizontal line above the channel and price data in every case.
>
> Can anyone see what could be the issue in the code below?
>
> //PROFIT LOCKING AND THE RELATIVE PRICE CHANNEL
> //"Profit Locking and The Relative Price Channel" article
> //AmiBroker S&C Traders' Tips monthly. Issue 1/2008
> //http://www.amibroker.com/members/traders/01-2008.html
> //http://www.traders.com/documentation/FEEDbk_docs/2008/01/TradersTips/TradersTips.html#amibroker
>
> dt = ParamDate("Date of the trend", "2008-11-20" );
> Value1 = Param("Bearish Periods", 21, 3, 55 );
> Value2 = Param("Multiplication Factor", 3.8, 1, 10 );
> Value3 = Param("Initial Stop", 19, 0, 1e6 );
> Value4 = Param("Channel Periods", 21, 3, 55 ); // Channel Periods
> Value5 = Param("Overbought region", 75, 1, 100 ); // Overbought region
> Value6 = Param("Channel Smoothing", 1, 1, 10 );
>
> HoldingDays = BarsSince( DateNum() < dt );
>
> Index = RSI( Value4 );
> OB = EMA( Index - Value5, Value6 );
> Bullish = Close - ( Close * OB/100 );
>
> Bearish = Sum( abs( Low - Ref( Low, -1 ) ), Value1 ) / Value1;
> RangeA = Sum( Close - Low, Value1 ) / Value1;
> Stop = Close - ( ( Bearish + RangeA ) * Value2 );
>
> TL = Null;
>
> for( i = 1; i < BarCount; i++ )
> {
> Prev = TL[ i - 1 ];
> Cond1 = Stop[ i ] > Prev;
>
> TL[ i ] = IIf( Cond1 AND Stop[ i ] > Value3, Stop[ i ],
> IIf( Cond1 AND Stop[ i ] < Value3, Value3,
> IIf( NOT Cond1, Prev, Stop[ i ] * HoldingDays[ i ] ) ) );
> }
>
> TL = IIf( HoldingDays == 0, Null, TL );
> Bullish = IIf( HoldingDays == 0, Null, Bullish );
>
> Plot( C, "Price", IIf( C > O, colorGreen, colorRed ), styleBar );
> Plot( TL, "TL", colorBlue );
> Plot( Bullish, "Bullish", colorLightGrey );
> PlotOHLC( TL, TL, Bullish, Bullish, "", ColorRGB( 230, 230, 230), styleCloud | styleNoLabel );
> Title = "{{NAME}} - {{DATE}} - {{VALUES}}";
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|