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

Re: [amibroker] Re: How to show Stops (ApplyStops) in Explore?



PureBytes Links

Trading Reference Links

I don't know where you are putting equity() but it must go after buy, etc. rules, as noted in the code outline (see http://www.amibroker.com/guide/a_equity.html)
 
Bill
 
----- Original Message -----
From: "janhausd" <janhaus@xxxxxxxxx>
Sent: Tuesday, January 08, 2008 12:33 AM
Subject: [amibroker] Re: How to show Stops (ApplyStops) in Explore?

>I figured something out, the placement of Equity(1,0) matters a lot to
> the output of the backtest. I'm a bit tired to go over and retest
> everything I did tonight, so I'll take a break and search tomorrow.
> Thanks for the help!
>
>
> --- In
amibroker@xxxxxxxxxxxxxxx, "janhausd" <janhaus@xxx> wrote:
>>
>> Thanks for the tips wavemechanic! I'm not getting much success with
>> switching any combination of the sell/short buy/cover combos (i.e.
>> exrem(buy, short) to exrem(buy,sell) etc.) but I'll keep trying. On
>> the other hand, I am trying to write my own stop using the
>>
>
http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/
>> webpage.
>>
>> A headscratcher now is that utilizing the code, i.e.
>>
>> Buy = cross(ma(c, 3), ma(c, 13))
>> Short = cross(ma(c, 13), ma(c, 3))
>> InTrade = Flip( Buy, Short );
>> sellstopline = IIf( InTrade, HighestSince( Buy, High ) * ( 1 - 0.01 *
>> TrailingStop ), Null );
>> coverstopline = IIf( InTrade, LowestSince( Short, Low ) * ( 1 + 0.01 *
>> TrailingStop ), Null );
>> Sell = Cross(sellstopLine,C);
>> Cover = Cross(C,coverstopline);
>> Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);
>> Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short);
>>
>> This seems to work, except when running BackTest, I see some trades
>> where it doesn't show that Trailing Stop worked, or if I specified a
>> higher MaxLoss %, it shows the MaxLoss%, seemingly ignoring the
>> trailing %.
>>
>> In detail, some trades have %'s stopped out that are much higher than
>> the TrailingStop I specified (i.e. I specify trailing stop at 5% and
>> in backtest I see Short(trail) or Long(trail) with >10% changes)...any
>> ideas? And yeah, I know it's possible to have a gap up between days,
>> so with all of those aside, I see instances on the same day where
>> there are a good number of down bars (>7) between (long)entry and
>> (maxloss, or none - no trailing!)exit and plenty of opportunity to
>> trail out, but no signal. Any ideas? Is there something wrong with my
>> code or is there something else?
>>
>> --- In
amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@> wrote:
>> >
>> > Or maybe you were thinking about buy = cover = ... and short = sell
>> = ...
>> >   ----- Original Message -----
>> >   From: wavemechanic
>> >   To:
amibroker@xxxxxxxxxxxxxxx
>> >   Sent: Monday, January 07, 2008 10:19 PM
>> >   Subject: Re: [amibroker] Re: How to show Stops (ApplyStops) in
>> Explore?
>> >
>> >
>> >   Looking more closely I would switch sell and short.  applystop
>> will stop buy with a sell not a short and stop a short with a cover
>> not a buy.  So have something like
>> >
>> >   sell = cover = 0
>> >   applystop( ...
>> >   buy = cross(ma(c, 3), ma(c, 13))
>> >   short = cross(ma(c, 13), ma(c, 3))
>> >   exrem( ...
>> >   exrem( ...
>> >   equity( ...
>> >   filter = ...
>> >   addcolumn( ...
>> >
>> >   Bill
>> >
>> >   ----- Original Message -----
>> >   From: "janhausd" <janhaus@>
>> >   To: <
amibroker@xxxxxxxxxxxxxxx>
>> >   Sent: Monday, January 07, 2008 6:48 PM
>> >   Subject: [amibroker] Re: How to show Stops (ApplyStops) in Explore?
>> >
>> >
>> >   > Yup, I indeed have equity(1), and I have also tried equity(1,0).
>> >   > The problem is that when I do a backtest the output shows the
>> trailing
>> >   > stop activating by showing Long (trail) in the Trade column.
>> However,
>> >   > when I use Explore, the trail doesn't shows up. I have the
>> columns in
>> >   > explore and I can sometimes see Sells with a value of 4,
>> however, I do
>> >   > not see all of them. At least for today, there is a trade that
>> appears
>> >   > to have hit the trailing stop via backtest but doesn't show up via
>> >   > Explore.
>> >   >
>> >   > --- In
amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@>
>> wrote:
>> >   >>
>> >   >> Do you have equity() in the code?  Look at its description and
>> >   > comments.  It assigns a value to the stop depending on the type of
>> >   > applystop chosen (e.g., trailing = 4).  A trailing sell stop
>> would = 4
>> >   > when hit and another column in exploration could be used to
> display
>> >   > the event (e.g, addcolumn(sell, "sell") producing 0 and 4 output).
>> >   >>
>> >   >> Bill
>> >   >>
>> >   >> ----- Original Message -----
>> >   >> From: "janhausd" <janhaus@>
>> >   >> To: <
amibroker@xxxxxxxxxxxxxxx>
>> >   >> Sent: Monday, January 07, 2008 4:09 PM
>> >   >> Subject: [amibroker] Re: How to show Stops (ApplyStops) in
> Explore?
>> >   >>
>> >   >>
>> >   >> >I did some more searching in the newsgroups and perhaps I
>> might need
>> >   >> > to write my own stops, although I would really like to just
>> use the
>> >   >> > built-in ones.
>> >   >> >
>> >   >> > To clarify my original question, there are some stops that I
>> can see
>> >   >> > via a backtest (i.e. Long(trail), indicating a long position
>> entered,
>> >   >> > and exited via trailing stop), but do NOT show up on Explore
>> (just
>> >   >> > shows Entry, not exit). Any way to write code to show these
>> trailing
>> >   >> > stops via 'Explore'?
>> >   >> >
>> >   >> > ps. I have code that includes the following:
>> >   >> > Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);
>> >   >> > Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short);
>> >   >> > Filter = Buy OR Sell OR Cover OR Short;
>> >   >> > Equity(1);
>> >   >> >
>> >   >> > --- In
amibroker@xxxxxxxxxxxxxxx, "LarsenE" <janhaus@> wrote:
>> >   >> >>
>> >   >> >> Hi,
>> >   >> >>
>> >   >> >> Sorry for this basic question, but I've been wading through
>> hundreds
>> >   >> >> of posts and haven't yet found the answer, will keep looking.
>> >   >> >> In the meantime, does anybody know how to show stops in
>> Explore? My
>> >   >> >> AFL code has some ApplyStops() functions, and the stops work
>> >   > perfectly
>> >   >> >> in backtest, and also shows up in scans, but how do I show
> these
>> >   > stops
>> >   >> >> in Explore? I have columns plotted for Buy,sell,cover,short,
>> and the
>> >   >> >> stop signals don't show up anywhere..
>> >   >> >>
>> >   >> >
>> >   >> >
>> >   >> >
>> >   >> >
>> >   >> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
>> >   >> >
http://www.amibroker.com/devlog/
>> >   >> >
>> >   >> > For other support material please check also:
>> >   >> >
http://www.amibroker.com/support.html
>> >   >> >
>> >   >> > Yahoo! Groups Links
>> >   >> >
>> >   >> >
>> >   >> >
>> >   >> >
>> >   >> >
>> >   >> > --
>> >   >> > No virus found in this incoming message.
>> >   >> > Checked by AVG Free Edition.
>> >   >> > Version: 7.5.516 / Virus Database: 269.17.13/1211 - Release
> Date:
>> >   > 1/6/2008 11:57 AM
>> >   >> >
>> >   >> >
>> >   >>
>> >   >
>> >   >
>> >   >
>> >   >
>> >   > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> >   >
http://www.amibroker.com/devlog/
>> >   >
>> >   > For other support material please check also:
>> >   >
http://www.amibroker.com/support.html
>> >   >
>> >   > Yahoo! Groups Links
>> >   >
>> >   >
>> >   >
>> >   >
>> >   >
>> >   > --
>> >   > No virus found in this incoming message.
>> >   > Checked by AVG Free Edition.
>> >   > Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release
>> Date: 1/7/2008 9:14 AM
>> >   >
>> >   > 
>> >
>> >
>> >
>>
> ------------------------------------------------------------------------------
>> >
>> >
>> >   No virus found in this incoming message.
>> >   Checked by AVG Free Edition.
>> >   Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date:
>> 1/7/2008 9:14 AM
>> >
>>
>
>
>
>
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>
http://www.amibroker.com/devlog/
>
> 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/
>
> <*> 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/

>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 1/7/2008 9:14 AM
>
>
__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___