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

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



PureBytes Links

Trading Reference Links

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