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

Re: [amibroker] How do I keep the buyprice while multiple buy signals happen



PureBytes Links

Trading Reference Links

Try usiing Applystop for the exits



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


On 07/07/06, Thomas Z. <tzg@xxxxxxxxxxxxxxxx> wrote:
>
>  Hi Andre,
>
> i think the easiest way would simply be to use the exrem function. It
> would assure that you only get a new buy after a sell.
>
>   *SYNTAX* *exrem( ARRAY1, ARRAY2 ) * *RETURNS* ARRAY ** *FUNCTION* removes
> excessive signals:
> returns 1 on the first occurence of "true" signal in Array1
> then returns 0 until Array2 is true even if there are "true" signals in
> Array1 ** *EXAMPLE* buy = ExRem( buy, sell );
> sell = ExRem( sell, buy );
>
> Best regards
>
> Thomas
> www.tradingbasis.com
>
>
>
>  ------------------------------
> *From:* amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] *On
> Behalf Of *Andre
> *Sent:* Friday, July 07, 2006 9:14 AM
> *To:* amibroker@xxxxxxxxxxxxxxx
> *Subject:* [amibroker] How do I keep the buyprice while multiple buy
> signals happen
>
>  Hello,
>
> This should be the simplest thing and I am simply running in circles
> with AFL not being able to give me what I want.
> Here's what I want in simple terms:
>
> ? Buy on MACD crossing (buy at Open the following day).
> ? Sell at 3% profit or at 10% loss.
>
> Period. That's all.
>
> The problem I am having is in "keeping" the purchase price at hand.
> Yes, I know about "ValueWhen" function, but I can't get it to work
> because I can easily have multiple buy signals before the sell
> occurs and a new Buy gives me a new BuyPrice that throws off all my
> profit and loss targets.
> Please advise. Thanks,
>
> Andre Perman
>
> 
>