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

Re: [trading] Re: [amibroker] .....and more ???



PureBytes Links

Trading Reference Links

Thanks again for your time, but still code returns the high of the entry bar as the 
buyprice, not the value of the cross + spread as buyprice. My heads spinning... :)

// TF = 5 min bars
Stok= StochD(13,3,3);
Stoka = StochD(7,3,3);
Time = TimeNum() >= 100000 AND TimeNum() <= 120000; //Set a time window for a buy
timeprice = ValueWhen(TimeNum()==100000,O) + 0.0020; //Add 20 pip filter to the open @ 
10:00
Buy2 = Cross(H,timeprice); // High crosses the filter=== true
BuyPrice = ValueWhen( Buy2, H) + 0.0004; // Should return the value of when high crossed 
the filter + add 4 pip spread.
Buy = buy2 AND (Stoka > Stok) AND Time ;
Sell = 0;

cheers



----- Original Message ----- 
From: "kaveman perth" <kavemanperth@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, October 14, 2004 10:37 AM
Subject: Re: [trading] Re: [amibroker] .....and more ???


>
> This may help a bit, What is variable Time? Needs to be a yes/no
> condition for how it is used
>
> timeprice = ValueWhen(cross(TimeNum(),95959),O) + 0.0020;// open at
> first price of day
>
> // HighT = H ;//not required
>
> Buy2 = Cross(H,timeprice); // High crosses value of variable "timeprice"
> BuyPrice = ValueWhen( Buy2, H); // This returns value of cross??? Yes
> Buy = buy2 AND (Stoka > Stok) AND Time ; //Buy conditions Assuming you
> have defined Stoka and Stok, and Time as  0 or 1 binary condition
>
> //Buy = Buy1 ; //buy conditions met - not required
> //BuyPrice = ValueWhen(Buy2,Buy2a) + 0.0004; // This should return
> value when cross - not required, change Buy2a above
>
>
> On Thu, 14 Oct 2004 10:22:39 +1000, Beachie <beachie41@xxxxxxxxxxx> wrote:
>>
>> OK, I've tried several things but I still can't get the value of when condition was 
>> true.
>> Now code just returns the H vaslue of the entry bar.
>>
>> timeprice = ValueWhen(TimeNum()==100000,O) + 0.0020;
>> HighT = H ;
>> Buy2 = Cross(HighT,timeprice); // High crosses value of variable "timeprice"
>> Buy2a = ValueWhen( Cross(HighT,timeprice), H); // This returns value of cross???
>> Buy1 = buy2 AND (Stoka > Stok) AND Time ; //Buy conditions
>> Buy = Buy1 ; //buy conditions met
>> BuyPrice = ValueWhen(Buy2,Buy2a) + 0.0004; // This should return value when cross
>> occurs???
>>
>> thanks again
>> ----- Original Message -----
>> From: "kaveman perth" <kavemanperth@xxxxxxxxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Thursday, October 14, 2004 9:29 AM
>> Subject: [trading] Re: [amibroker] .....and more ???
>>
>> >
>> > What is the price when the condition is true? Just use that in buyprice =
>> >
>> >
>> > On Thu, 14 Oct 2004 09:24:54 +1000, Beachie <beachie41@xxxxxxxxxxx> wrote:
>> >>
>> >> OK, thanks for that. As you can guess programming is not my forte. Next question is 
>> >> how
>> >> do
>> >> I extract the value for when buy1 == true?
>> >> I thought this would work but it still returns the low
>> >>
>> >> Buy1 = Time AND H > ValueWhen(TimeNum()==100000,O)  + 0.0020 AND Stoka > Stok;
>> >> Buy = Buy1 ; <-- I thought this then triggered a buy as condition was met & Buy ==
>> >> price
>> >> BuyPrice = Buy + 0.0004;
>> >>
>> >> I thought of using "ValueWhen" i.e. ValueWhen(buy1,????)  but it will only allow me 
>> >> to
>> >> use
>> >> another array ie. H,L,O, C etc, whereas I need the actual price when condition was
>> >> true.
>> >> Sorry if it's a very simple answer, but I can't get my head around it...
>> >> thanks
>> >>
>> >> ----- Original Message -----
>> >> From: "kaveman perth" <kavemanperth@xxxxxxxxx>
>> >>
>> >> >
>> >> > Buy1 is assigned a 0 or 1 according to whether all the conditions are
>> >> > true or not
>> >> > You have not assigned a buyprice in your statement only when buy if
>> >> > 0/1 + 0.004, so AB then looks for the nearest price within the bar, be
>> >> > it H or L
>> >> >
>> >> >
>> >> > On Thu, 14 Oct 2004 08:22:31 +1000, Beachie <beachie41@xxxxxxxxxxx> wrote:
>> >> >>
>> >> >> on going from previous post, why is my Buyprice assigned the *low* of the bar 
>> >> >> even
>> >> >> though
>> >> >> I specify what the value should be??? I checked back throught the archives, and 
>> >> >> this
>> >> >> all
>> >> >> seems kosher code.......
>> >> >>
>> >> >> Buy1 = Time AND H > ValueWhen(TimeNum()==100000,O)  + 0.0020 AND Stoka > Stok; // 
>> >> >> so
>> >> >> here
>> >> >> "buy1" variable is assigned price - which is definitely not the low for 99.9% of
>> >> >> instances
>> >> >> Buy = Buy1 ;
>> >> >> BuyPrice = ValueWhen(Buy,Buy1) + 0.0004; //Price is always the  low of the bar, 
>> >> >> not
>> >> >> the
>> >> >> value that caused the Buy condition to be true + spread of 0.0004
>> >> >>
>> >> >>
>> >> >> Check AmiBroker web page at:
>> >> >> http://www.amibroker.com/
>> >> >>
>> >> >> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> >> >> Yahoo! Groups Links
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers
>> >> > Graham
>> >> > http://e-wire.net.au/~eb_kavan/
>> >> >
>> >> >
>> >> >
>> >> > Check AmiBroker web page at:
>> >> > http://www.amibroker.com/
>> >> >
>> >> > Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> >> > Yahoo! Groups Links
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >> Check AmiBroker web page at:
>> >> http://www.amibroker.com/
>> >>
>> >> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> >> Yahoo! Groups Links
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers
>> > Graham
>> > http://e-wire.net.au/~eb_kavan/
>> >
>> >
>> >
>> > Check AmiBroker web page at:
>> > http://www.amibroker.com/
>> >
>> > Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>> Check AmiBroker web page at:
>> http://www.amibroker.com/
>>
>> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>
>
> -- 
> Cheers
> Graham
> http://e-wire.net.au/~eb_kavan/
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>
>
> 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

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