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

Re: [amibroker] Fllip ( Buy, Applystop ??????????)



PureBytes Links

Trading Reference Links

Hi Chris --

You can get that information if you use Custom Backtester.  Search AmiBroker Help for Portfolio Backtester.  Then scroll down to the section that explains Exit.

Thanks,
Howard

On Feb 17, 2008 3:22 AM, ChrisB <kris45mar@xxxxxxxxxxxx> wrote:

Howard

Always appreciate your replies.

Had hoped to be able to access the differing Sell values as per
Sell = whatever; // is Sell == 1 value
Applystop( StoptypeLoss, .......); // is Sell == 2 value
Applystop( StopTypeProfit, ...); // is Sell == 3 value etc

to do this but I cannot get it to work.

However I have tried your loop solution and it works well.

Thank you.

Regards

ChrisB.



Howard B wrote:
>
> Greetings --
>
> Having the price hit a stop does not set Sell to True.
>
> Run the following code as a backtest and look at the trades. Many of
> the months the exit is made at the profit target.
>
> // TestApplyStop. afl
>
> Buy = Month()!=Ref( Month(),- 1);
> ApplyStop(stopTypeP rofit,stopModePe rcent,2);

> Sell = BarsSince(Buy) >=15;
>
> Filter = 1;
> AddColumn(Buy,"Buy",1.0);
> AddColumn(Sell,"Sell",1.0);
>
>
> Run it again as a exploration. Buy is True on the first trading day
> of the month, and Sell is always True 15 days later, but is never True
> earlier than that, even when the exit was made at the profit target.
>
> So --- you probably need to write a loop to set the entry in the array
> you want to use in your Flip statement for whatever conditions you
> want it set. In your loop, test the condition that hits your stop and
> set StopHit (or whatever else you want to call it) when the price
> triggers the stop. Then, after that loop, use Flip.
>
>
>
>
> //pseudo code
> Buy = xxxx;
> ApplyStop(xxxx) ;
>
> StopHit = 0;
> for (i=0; i<BarCount; i++)
> {
> If (Close[i] >= xxx) StopHit[i] = 1;
> }
>
> InLong = Flip(Buy,StopHit) ; // or whatever
>
>
>
>
>

__._,_.___

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

__,_._,___