[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Applystop turned on only after n days



PureBytes Links

Trading Reference Links

Tomasz, Graham,

Thanks for the assistance.  Will give this a try.

Mark

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> Forgot one thing: of course "Volatile" parameter should be turned 
on:
> 
> buy=
> sell=
> 
> LongerThan20Days=BarsSince( ExRemSpan( Buy, 20 ) ) >= 20; // 20 
days activation delay
> 
> // 15% stop if longer than 20 days, otherwise 99% stop 
(effectively no stop)
> 
> ApplyStop( StopTypeTrailing, StopModePercent, IIF( 
LongerThan20Days, 15, 99 ), True, True );
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Tomasz Janeczko" <amibroker@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, August 22, 2005 2:16 PM
> Subject: Re: [amibroker] Re: Applystop turned on only after n days
> 
> 
> > Hello,
> >
> > ApplyStop is a switch that turns internal stop processing, so
> > it can not be used conditionally on bar-by-bar basis.
> > Instead pass ARRAY to "amount" field:
> >
> > buy=
> > sell=
> >
> > LongerThan20Days=BarsSince( ExRemSpan( Buy, 20 ) ) >= 20; // 20 
days activation delay
> >
> > // 15% stop if longer than 20 days, otherwise 99% stop 
(effectively no stop)
> >
> > ApplyStop( StopTypeTrailing, StopModePercent, IIF( 
LongerThan20Days, 15, 99 ), True );
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message ----- 
> > From: "Graham" <kavemanperth@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Monday, August 22, 2005 2:54 AM
> > Subject: Re: [amibroker] Re: Applystop turned on only after n 
days
> >
> >
> >> you need to use the bar identifier for array elements within a 
loop
> >> and some items have no need ot be within the loop, plus some 
errors. I
> >> am also not certain if applystop works within a loop as never 
tried
> >> that before. To exclude added buy rules between buy and sell use
> >> buy=exrem. Your intrade was not used anywhere so no need for it
> >>
> >> buy = whatever
> >> sell=whateverelse
> >>
> >>    buy = ExRem(Buy,Sell);
> >>    DaysInTrade = BarsSince(Buy)>20
> >>
> >> for(i=0; i<BarCount; i++)
> >>  {
> >>    if(DaysInTrade[i])
> >>      {
> >>        ApplyStop(StopTypeTrailing, StopModePercent,15);
> >>      }
> >>  }
> >>
> >> easiest just to use
> >> buy = whatever
> >> sell=whateverelse
> >>
> >>    buy = ExRemspan(Buy,20);
> >>
> >> another thing I am uncerttain odf is the use of applystop in
> >> association with exremspan, as this just stops any added buys 
from
> >> occuring for 20 bars. So I may have been incorrect.
> >> Should remember to test ideas before sending them
> >>
> >>
> >> On 8/22/05, mp61276127 <mpalmer@xxxx> wrote:
> >>> Graham,
> >>>
> >>> You may have suggested the answer to a problem I didn't know I 
had
> >>> yet.  Will keep in mind as I am working my way through this.
> >>>
> >>> However, my current problem is that I don't fully understand 
why
> >>> my "If" statement isn't working.  The explanation for the 
error 6
> >>> code tells me that arrays can't be processed with the "If"
> >>> statement.  I'm not sure how I would redo this code to 
accomplish my
> >>> objective without using the buy array.
> >>>
> >>> Mark
> >>>
> >>> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> 
wrote:
> >>> > have you tried exremspan?
> >>> >
> >>> > On 8/22/05, mp61276127 <mpalmer@xxxx> wrote:
> >>> > > The Problem: Don't want my Applystop to be effective until 
in the
> >>> > > trade for n days.
> >>> > >
> >>> > > Tried using the code below but I get an "Error 6" code.  
Help
> >>> tells me
> >>> > > that I must act on Boolean expression (True or False) and 
not on
> >>> > > arrays. I'm still having trouble understanding If,Else, For
> >>> statements
> >>> > > and how they are used in Amibroker.  It looks to me like I 
am
> >>> working
> >>> > > on a boolean statement.
> >>> > >
> >>> > > Any help here would be much appreciated.
> >>> > >
> >>> > > Thanks
> >>> > > Mark
> >>> > >
> >>> > > MY CODE:
> >>> > >
> >>> > > Buy = Buy Rules;
> >>> > > Sell = Sell Rules;
> >>> > >
> >>> > > for(i=0; i<BarCount; i++)
> >>> > >  {
> >>> > >    intrade = ExRem(Buy,Sell);
> >>> > >    DaysInTrade = BarsSince(Buy[i]>20)
> >>> > >    if(DaysInTrade)
> >>> > >      {
> >>> > >        ApplyStop(StopTypeTrailing, StopModePercent,15);
> >>> > >      }
> >>> > >  }
> >>> > >
> >>> > >
> >>> > >
> >>> > >
> >>> > >
> >>> > >
> >>> > > Please note that this group is for discussion between 
users only.
> >>> > >
> >>> > > To get support from AmiBroker please send an e-mail 
directly to
> >>> > > SUPPORT {at} amibroker.com
> >>> > >
> >>> > > For other support material please check also:
> >>> > > http://www.amibroker.com/support.html
> >>> > >
> >>> > >
> >>> > > Yahoo! Groups Links
> >>> > >
> >>> > >
> >>> > >
> >>> > >
> >>> > >
> >>> > >
> >>> > >
> >>> >
> >>> >
> >>> > --
> >>> > Cheers
> >>> > Graham
> >>> > AB-Write >< Professional AFL Writing Service
> >>> > Yes, I write AFL code to your requirements
> >>> > http://e-wire.net.au/~eb_kavan/ab_write.htm
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Please note that this group is for discussion between users 
only.
> >>>
> >>> To get support from AmiBroker please send an e-mail directly to
> >>> SUPPORT {at} amibroker.com
> >>>
> >>> For other support material please check also:
> >>> http://www.amibroker.com/support.html
> >>>
> >>>
> >>> Yahoo! Groups Links
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >> -- 
> >> Cheers
> >> Graham
> >> AB-Write >< Professional AFL Writing Service
> >> Yes, I write AFL code to your requirements
> >> http://e-wire.net.au/~eb_kavan/ab_write.htm
> >>
> >>
> >>
> >> Please note that this group is for discussion between users 
only.
> >>
> >> To get support from AmiBroker please send an e-mail directly to
> >> SUPPORT {at} amibroker.com
> >>
> >> For other support material please check also:
> >> http://www.amibroker.com/support.html
> >>
> >>
> >> Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hvfg40l/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1124762184/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html";>Help tsunami villages rebuild at GlobalGiving. The real work starts now</a>.</font>
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> 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/