PureBytes Links
Trading Reference Links
|
Dear Collectible:
TJ wrote about this "last theoretical trade" way back on Feb 22, 2002. Here
is his suggestion, which I saved in my archives:
Let's suppose that you system generatesentry and exit signals based on
break out:LongEntry = ... formula here ...LongExit = .... formula
here...Now you canLongEntry = ExRem( LongEntry, LongExit
);LongExit = ExRem( LongExit, LongEntry );TheoreticalTradeProfit =
ValueWhen( LongExit, SellPrice ) - ValueWhen( LongEntry, BuyPrice );Buy
= LongEntry AND TheoreticalTradeProfit < 0; // enter only if previous trade
was loosingSell = LongExit;Best regards,Tomasz Janeczko
Hope this helps.
Al Venosa
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
<A title=telecard@xxxxxxxxxxxxxx
href="">Collectable Images
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Friday, July 09, 2004 7:34 AM
Subject: RE: [amibroker] CONDITIONAL
Looping??
<FONT face=Arial color=#0000ff
size=2>Hello herman,
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>thanks for the response.
<FONT face=Arial color=#0000ff
size=2>
The
SAR was I guess a red herring. I did not explain clearly what I was
meaning.
<FONT face=Arial color=#0000ff
size=2>
The
turtles did what i am suggesting (trying to do). They only allowed an entry in
the long direction if the previous entry in the opposite direction (the short)
failed.
<FONT face=Arial color=#0000ff
size=2>
I
wil try to put it simply.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>BUY Rule Triggered LONG ENTRY
TAKEN.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>If Stopped out = No. Then
<FONT face=Arial color=#0000ff
size=2>Sell Signal reached. Close out trade.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>If Trade was profitable then continue looking for next Long
trade.
<FONT face=Arial
size=2>
<FONT face=Arial color=#0000ff
size=2>If Stopped out = Yes. Then Close out
trade.
<FONT face=Arial color=#0000ff
size=2>Find the Sell signal (asuming no stop out occured). <SPAN
class=796441511-09072004>If Trade would
have been profitable then continue looking for next Long
trade.
<FONT face=Arial color=#0000ff
size=2><SPAN
class=796441511-09072004>
<FONT face=Arial color=#0000ff
size=2><SPAN
class=796441511-09072004>
<FONT face=Arial color=#0000ff
size=2>If trade is not profitable then
next Buy signal is NOT TAKEN as an Entry.
<FONT face=Arial color=#0000ff
size=2>Monitor for next sell signal and
see if trade would have been profitable.
<FONT face=Arial color=#0000ff
size=2><SPAN
class=796441511-09072004>
<FONT face=Arial color=#0000ff
size=2>If trade would have been
profitable flip so nex tbuy signal is taken as
atrade.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Dittto for the Short
rules.
T<SPAN
class=796441511-09072004>his is the closest I have found so far. I need to put
in some way to test whether trade would have been profitable and to include
or exclude trades based on whether the prefious one in that direction
was profitable or not.
<SPAN
class=796441511-09072004>
<SPAN
class=796441511-09072004>
EnableScript("VBScript");hh = HHV( close, 250 );// buy rules
buy = Close == myruleshere; //conditions 1 and conditions 2
// ensure that sell is an array,
// sell = 0 would set the type to numbersell = buy;
<%
close = AFL("close")
buy = AFL( "buy" )
sell = AFL("sell") ' this variable holds last buying price
' if it is zero it means that no trade is open
lastbuyprice = 0 ' iterate along the array
for i = 0 to UBound( close )
sell( i ) = 0 ' Remove Buy signals if trade was already initiated
if( lastbuyprice > 0 ) then
buy( i ) = 0
end if ' if there is no open trade and buy signal occurs
' get the buying price
if ( lastbuyprice = 0 ) AND (buy( i ) = 1) then
lastbuyprice = close( i )
end if ' if trade is open and sell condition is valid
' generate sell signal
' and close the trade
if (lastbuyprice >0 ) AND ( close( i ) > ( 1.1 * lastbuyprice ) ) then
sell( i ) = 1
lastbuyprice = 0
end if
next AFL("buy") = buy
AFL("sell") = sell%>buy = buy;
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial
color=#0000ff size=2> Check
AmiBroker web page at:<A
href="">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.
|