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

[amibroker] Re: Best exit price?



PureBytes Links

Trading Reference Links


Hi Herman,

Yes, I did mange to plot (by creating a new indicator), many thanks. 
It does show the best prices that could have been achieved. The ref 
function in the last line:
 
BestSellPrice = Ref(Temp ,-1);

seems redundant. I used BuySellPrice = temp and it gives the same 
results.

I then pasted the whole code into Explorer and I managed to obtain 
some output. I then copied and pasted into Excel (had to do this 
twice, with different filter settings in Explorer) and then had to 
do a few manipulations in Excel to obtain something which was close 
to what I wanted. Not at all elegant, i'm afraid!!!

I tried to use the code in the backtester (without the plot) but it 
didn't work there. I set SELL= bestsellprice. Any way of just using 
the code in the backtester?

Any further suggestions to try and simplify would be appreciated!!

Many thanks again

Sam





--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen" 
<psytek@xxxx> wrote:
> Did you plot the code i posted [ Tue 01/18/2005 7:59 PM ]? Your 
best bet to
> solve this problem is to visualize it.
> 
> herman
>   -----Original Message-----
>   From: qweds_560 [mailto:qweds_560@x...]
>   Sent: Wednesday, January 19, 2005 12:34 PM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: [amibroker] Re: Best exit price?
> 
> 
> 
>   Many thanks Graham,
> 
>   Unfortunately, it doesn't seem to work. I may be doing something
>   wrong:
> 
>   My code is:
> 
>   buy=...conditions
>   short=...conditions
> 
>   sell=short;
>   cover=buy;
> 
>   BestLong = valuewhen( sell, highestsince(buy,h) );
>   BestShort = valuewhen( cover, lowestsince(short,L) );
> 
>   Sell=bestlong;
>   Cover=bestshort;
> 
>   Buy = ExRem(Buy,Short);
>   Sell = ExRem(Sell,Buy);
>   Short = ExRem(Short,Buy);
>   Cover = ExRem(Cover,Short);
> 
>   The sell happens on the next bar after a buy rather than 
searching
>   for the highest high before a short signal.
> 
>   Any assistance would be appreciated,
> 
>   Cheers
> 
>   Sam
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> 
wrote:
>   > You can probably get more complex or easier solutions, here is 
one
>   >
>   >
>   > BestLong = valuewhen( sell, highestsince(buy,h) );
>   > BestShort = valuewhen( cover, lowestsince(short,L) );
>   >
>   >
>   >
>   > On Tue, 18 Jan 2005 23:22:43 -0000, qweds_560 <qweds_560@xxxx>
>   wrote:
>   > >
>   > >
>   > > Hello,
>   > >
>   > > I have been trying to solve this problem for some time using 
all
>   > > sorts of functions in the backtester: HHV, barssince, 
valuewhen,
>   > > barindex and so on.
>   > >
>   > > Consider a simple stop and reverse system. I want to know 
what
>   the
>   > > best exit price could have been from a long position before 
the
>   > > system reverses and what the best exit price that could be 
from a
>   > > short position before the system reverses and goes long.
>   > >
>   > > To put it another way, I would like to peek into the future 
to
>   see
>   > > what the best price I could exit my position at BEFORE I 
receive
>   a
>   > > signal in the opposite direction.
>   > >
>   > > I am trying to find out the maximum profit that could be made
>   using
>   > > the system if you had the foresight to know exactly when to 
exit
>   > > each and every position.
>   > >
>   > > I would be grateful for any suggestions.
>   > >
>   > > Many thanks
>   > >
>   > > Sam
>   > >
>   > >
>   > > 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
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
> 
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> 
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of Service.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/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/