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

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



PureBytes Links

Trading Reference Links

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(stopTypeProfit,stopModePercent,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







On Feb 16, 2008 6:01 AM, ChrisB <kris45mar@xxxxxxxxxxxx> wrote:

Is it possible to use Flip with Applystop as the only exit?

as in ....

Buy = myConditions;
Sell = 0;

Applystop( whatever is needed, .........);

InLong = Flip( Buy, what_do_I_put_here_ in_lieu_of _Sell?);

Have tried the Equity(); function and

exit = Sell == 2; //for e.g. for StopTypeLoss

InLong = Flip( Buy, Sell == 2);

with no joy.

Can this be done somehow?

--
Regards

ChrisB


__._,_.___

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

__,_._,___