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

Re: [amibroker] Re: Buysignal + wait



PureBytes Links

Trading Reference Links

This code (snippet) was posted in another thread a few days ago (and I can't find it!!)
It implements a wait period for a setup gracefully using exRamSpan.
You could use bits of this for 2.
If you know who wrote the code please pass on my regards:

waitPeriod = 10;
triggerPercentage = 1;

SetupLong = ExRemSpan(C < BBandBot(C, 20, 2), waitPeriod);
SetupPriceLong = ValueWhen(SetupLong,H) * triggerPercentage;
Buy = Cross(H, SetupPriceLong) && BarsSince(SetupLong) < waitPeriod;
BuyPrice = SetupPriceLong;

bernardedmond01 wrote:
> Hi GP
> Both good points. I'm afraid I'm at the start of my learning curve 
> on AFL.
> 1. Triggerpoint is supposed to be the value at the Longsetup. 
> 2. No, of course, would not want to buy if a stop had been triggered 
> in the meantime. Suppose would want to enter within 5 bars.
> How should code be amended?
> Here's my attempt:
> 
> Longsetup = xxx;
> period = 5;
> Triggerpoint = ValueWhen (Longsetup, HHV(H,3));
> Buy = Cross(H,Triggerpoint) AND BarsSince (Longsetup)<=period AND 
> Sell == 0;
> 
> What do you think?
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@xxx> 
> wrote:
>> A couple of issues here.
>>
>> Firstly, is Triggerpoint supposed to be the value at the Longsetup 
> bar
>> or the current bar? If the latter, then you'll never get a trigger
>> because H can never be greater than HHV(H,3)+0.01. If the former, 
> then
>> you need to latch in the value of HHV(H,3)+0.01 at the Longsetup 
> bar
>> until you get the trigger.
>>
>> Secondly, is there any condition to cancel your Longsetup before
>> getting the trigger condition? For example, if the stock completely
>> tanks immediately after the Longsetup condition, do you still want 
> to
>> buy when the trigger condition is subsequently met (ignoring the 
> first
>> issue above), even if it's at a much lower price and/or much later?
>>
>> GP
>>
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@> wrote:
>>> Look at the FLIP command to maintain your initial setup 
> condition,
>> then use 
>>> AND H>Triggerpoint.
>>>
>>> Once triggered, use FLIP again to reset.
>>>
>>> ----- Original Message ----- 
>>> From: "bernardedmond01" <bernardedmond01@>
>>> To: <amibroker@xxxxxxxxxxxxxxx>
>>> Sent: Thursday, June 14, 2007 4:54 PM
>>> Subject: [amibroker] Buysignal + wait
>>>
>>>
>>>> Hi all
>>>> How do I say the code in square brackets:
>>>>
>>>> Triggerpoint = HHV(H,3) + 0.01;
>>>> Longsetup = xxx;
>>>> Buy=Ref(Longsetup,-1) = = 1 [and wait until H>Triggerpoint];
>>>>
>>>> that is, the Lonsetup occurred on the previous bar but I don't 
> enter
>>>> until the high>Triggerpoint (which may be on the same or a 
> later bar)?
>>>> Thanks
>>>>
>>>>
>>>>
>>>>
>>>> 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
>>>>
>>>>
>>>>
> 
> 
> 
> 
> 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
> 
> 
> 
> 
> 


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/