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

RE: [amibroker] eSignal



PureBytes Links

Trading Reference Links










This is why I tried to explain the need for finding a unique
occurrence for defining a value at a particular bar.

DaysML and DaysMH are arrays and the values will change
throughout the chart. Now when you want to define a particular value of those
arrays you must have a unique definition of when you want that value. Using Valuewhen
requires a single value of the arrays to find a single value of what you want.
If you just define that value with an array it has multiple choices and will
select the most recent answer.

As an example your line

<span
>PML = ValueWhen(LLVBars(L, Ref(n, -1)), L,
1);

Gives the valuewhen a whole array of values to select from
by using LLVBars(L,xxx). What you really weant is to define the value of PML as
when the Low price is equal to the lowest low of the previous 20 days. So it is
mush better to just say this in your function.

This then becomes a correct definition of finding the value
of Low price at a particular bar and should give you the value you want. So by
using this instead

<span
>PML = ValueWhen(   L == ref( LLV(L,
20), -1)  , L, 1);

 

Does this explain it a bit better. 

 

Computers may be complex to use, but simple logic is
required to drive them.

 



Cheers,
Graham
http://e-wire.net.au/~eb_kavan/ 



<span
>-----Original Message-----
From: Collectable Images
[mailto:telecard@xxxxxxxxxxxxxx] 
Sent: Tuesday, July 06, 2004 10:38
AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] How is
this possible?

<font size=2
face="Times New Roman"> 



<font size=2 color=blue
face=Arial>Graham,





<font size=2
face="Times New Roman"> 





<font size=2 color=blue
face=Arial>your
input as always is appreiated.





<font size=2
face="Times New Roman"> 





<font size=2 color=blue
face=Arial>What I
am very confused about is why when the program is on the bar which entry is
made at, why it uses the correct value for PMH to signal teh entry but then is
unable to use the correct value of PMH to find the entry price. Surely the
value of PMH should be the smae until the next bar. Thats the issue. How do I
know when the porgram will change a variable like this mid bar so to speak?
Therein lies the uncertainty factor.





<font size=2
face="Times New Roman"> 





<font size=2 color=blue
face=Arial>Don





-----Original Message-----
From: Graham
[mailto:gkavanagh@xxxxxxxxxxxxx]
Sent: Tuesday, 6 July 2004 12:28
PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] How is
this possible?

<span
>Collectable

<font size=2
face="Times New Roman"> 

<span
>A suggestion is to always have a buy/sell
condition as an unique event. This means it happens on a single bar, rather
than many bars. This helps by immediately removing many unwanted signals. This
will save many headaches later on when you want to condition the sell around
the buy bar or price.

<font size=2
face="Times New Roman"> 

<span
>Cond10 = Cross( H, PMH);

<span
>Buy = Cond10;

<font size=2
face="Times New Roman"> 

<span
>The buy price should then be tied to
the day of purchase, per buy signal and tradedelays.

<font size=2
face="Times New Roman"> 

<span
>BuyPrice = Valuewhen( Buy, Max(PMH +
0.01, O) ); //if you had trade delays set to 1 then use ref(Buy,-1)

<font size=2
face="Times New Roman"> 

<span
>The finding highest since the lowest
of the last 20 bars could be this (just an alternative way of doing it)

<font size=2
face="Times New Roman"> 

<span
>DaysMH = highestsincebars ( L = ref(
LLV( L, 20 ), -1 );

<font size=2
face="Times New Roman"> 

<span
>To answer your original problem, you
have set the trade delays to 0, so when it looks for PMH this is defined as the
high before the buy signal, so on the day of the buy it will see only the value
of the day before for PMH. Hope this is not confusing <font
size=3 face=Wingdings>L

<span
>In your PMH and PML you use
valuewhen but you need to actually define a unique occurrence for this to be
useful, else it just looks at any old possible bar.

<font size=2
face="Times New Roman"> 

PML = ValueWhen(  <span
>L== LLV (L, Ref(n, -1)),    L, 1); //finds the value of low at
lowest low date
PMH = ValueWhen( H== HHV<font
color=blue> (H, Ref(DaysML, -1)), H, 1); //finds the
value of high at highest high date

<span
>Hope I have helped a bit, and not
confused the issue too much.

<font size=2
face="Times New Roman"> 

<font size=2
face="Times New Roman"> 



<span
>Cheers,
Graham
http://e-wire.net.au/~eb_kavan/ 



<span
>-----Original Message-----
From: Collectable Images
[mailto:telecard@xxxxxxxxxxxxxx] 
Sent: Tuesday, July 06, 2004 9:48
AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] How is this
possible?

<font size=2
face="Times New Roman"> 

<span
>Now this will find the LOWEST LOW in the last 20 days
and the highest High since that date.

All signals are generated on chart correctly to show the buy and sel ldays
based on this code. ie when price breaks the highest high (PMH) entry is made
so code is referenceing the valuewhen function corectly.

Now, when I look at the actual buy and sell prices obtained  it fails to
reference the correct values for PMH and looks like it is taking the value of
the high from the day before the entry.



<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">I feel I am about to
scream with chasing my self round in circles all week!!



<span
>

DaysML = Ref(LLVBars(L, 20), -1);
//finds the number of days since the lowest low within last 20 days
DaysMH = Ref(HHVBars(H, DaysML), -1); //finds teh highest high since the lowest
low date


PML = ValueWhen(LLVBars(L, Ref(n, -1)), L, 1); //finds the value of low at
lowest low date
PMH = ValueWhen(HHVBars(H, Ref(DaysML, -1)), H, 1); //finds the value of high
at highest high date

Cond10 =  H > PMH; //Enter when High of highest day is broken



Buy = Cond10;
BuyPrice = Max(PMH + 0.01, O); //Buy Price criteria Buys at 1 cent break of
Highest price in last (daysML) number of days

Sell = Cross(Ref(LLV(L, 4), -1), L); //sells at break of lowest low in last 4
days
SellPrice = C; //sells at close price of day of break

Buy = ExRem(Buy, Sell);


SetTradeDelays(0, 0, 0, 0);



Check AmiBroker web page at:<font
face="Courier New">
http://www.amibroker.com/

Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html







Check AmiBroker web page at:<font
face="Courier New">
http://www.amibroker.com/

Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html






<font size=2
face="Times New Roman">

Check AmiBroker web page at:<font
face="Courier New">
http://www.amibroker.com/

Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html










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

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.