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

RE: [amibroker] Re: Triggering a Chandelier trailing stop with % favorable price excursion



PureBytes Links

Trading Reference Links

Dave,

Sorry, I did not notice your BeginValue. Take this out. It gives the
beginning value of the array. Your result WILL then be an array, but
that is what you really want in Amibroker because ALL Buys are computed
at once and thus all OpenPrices need to be computed at once as well.

However, this gets into the problem of not being able to affect the Buy
array with follow-on code without using loops.
--
Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of cohndw
Sent: Monday, July 24, 2006 10:26
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Triggering a Chandelier trailing stop with %
favorable price excursion

Terry,

Thanks for getting back to me quickly. 

You say the code should work, but when I attempt to print out the 
OpenPrice value I get the standard -1E10 monster value which 
indicates that OpenPrice was never defined, or is being treated as an 
array rather than a number.  The next line of code that works with 
OpenPrice is

PcntExcursion = ( ( Open - OpenPrice ) / Open ) * 100.0;

Note that Open is the standard Open price array.   My thinking is
this will create a new array, PcntExcursion, which provides 
percentage price excursion from the BuyPrice.  Again, when I attempt 
to print out this array I get the -1E10 monster value, indicating 
this array is not assigned.

The other idea I had for grabbing the buy price (the Open at the 
EntryBar) was code that looked like this:

TempPrice = Ref(BuyPrice,-(BarIndex()-EntryBar));
OpenPrice = BeginValue(TempPrice);

Where EntryBar is the bar the buy is made on.

Or alternatively something like:

PcntExcursion = ( ( Open - Ref(BuyPrice,-(BarIndex()-EntryBar)) ) / 
Open ) / 100.0;

Thanks,

Dave


--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxx> wrote:
>
> Your code should work in retrieving the Open price on the day you 
buy.
> You probably should get the BuyPrice in case trade delays are set. 
> 
> However, you will need to use loops to affect the results because 
when
> using array processing you cannot affect the array with code below 
the
> original line. 
> 
> That's probably a confusing statement. I would need more of your 
code to
> make any recommendations.
> --
> Terry
> 
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On
> Behalf Of cohndw
> Sent: Sunday, July 23, 2006 21:50
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Triggering a Chandelier trailing stop with %
> favorable price excursion
> 
> I am trying to calculate the % favorable price excursion based on 
the
> current price vs the buy price, and then turn on a Chandelier 
trailing
> stop if a % favorable price excursion threshhold is hit to lock in
> more profits.  I am unable to grab the buyprice on the first buy
> (opening price).  The code I am using is shown below.
> 
> OpenPrice = BeginValue(ValueWhen(Buy>0,Open,1));
> 
> Thanks,
> 
> Dave
> 
> 
> 
> 
> 
> 
> 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 other support material please check also:
> http://www.amibroker.com/support.html
> 
>  
> Yahoo! Groups Links
>







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 other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links