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

[amibroker] Re: Displaced MA



PureBytes Links

Trading Reference Links




Hello 
herman,
<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.
<SPAN 
class=796441511-09072004> 
<SPAN 
class=796441511-09072004> 
<SPAN 
class=796441511-09072004>If trade is not profitable then next Buy signal 
is NOT TAKEN as an Entry. 
<SPAN 
class=796441511-09072004>Monitor for next sell signal and see if trade 
would have been profitable.
<SPAN 
class=796441511-09072004> 
<SPAN 
class=796441511-09072004>If trade would have been profitable flip so nex 
tbuy signal is taken as atrade.
<SPAN 
class=796441511-09072004> 
<SPAN 
class=796441511-09072004> 
<SPAN 
class=796441511-09072004>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;
<SPAN 
class=796441511-09072004> 
<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:
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.