Thank you Lief and Keith.

I'd never used ExRem before, and for some stupid reason, I thought it was a 
cosmetic thing that removed the signal arrows from the chart

I haven'tquite honed it down yet, but certainly the 
    Buy = ExRem( Buy, Short );
    Short = ExRem( Short , Buy );
works well.

Thanks again.

Robert Z





________________________________
From: Leif P <[email protected]>
To: [email protected]
Sent: Sat, 6 March, 2010 1:05:01 AM
Subject: [amibroker] Re: Only buy the first time the condition is true

  
Did you look at the ExRem command: 

buy = ExRem( buy, sell );
sell = ExRem( sell, buy ); 

which helps ignore multiple signals.

You might also look at the Flip command. 

--- In amibro...@yahoogrou ps.com, "ics4mer" <ics4...@... > wrote:
>
> Hi,
> 
> Looking for some help with following situation.
> 
> Say we have 3 moving averages:
> 
> MA_Short = MA(C,20)
> MA_Med = MA(C,100)
> MA_long = MA(C,200);
> 
> My signals are the following
> 
> Buy  = MA_Med > MA_Long AND Cross(MA_Short, MA_Med);
> Sell = Cross(MA_Med, MA_Short);
> 
> However, I only want to trade the first occurence of cross(MA_short, MA_Med).
> 
> I don't want to take another long trade until MA_Med has dipped below MA_Long 
> and risen above MA_Long again and the Cross(short, med) situation occurs 
> again.
> 
> I suspect it has something to do with the flip() function but I can't quite 
> sus it out!
> 
> I've nearly worked it out with a loop, but I'm sure that it's not the correct 
> way to use AFL.
> 
> Any help greatly appreciated!
> 
> TIA
> 
> Robert
>


 


      

Reply via email to