I want to simplify my life, believe me.  I'm having a bit of difficulty 
following what you're saying to do.  Here is some sample code, just in case I'm 
not being clear:

Buy = Cross(StochFinal,Trigger) AND (EMA( Close,EMAShort ) > EMA( Close,EMALong 
));

Sell = Cross(Trigger,StochFinal) AND (EMA( Close,EMAShort ) < EMA( 
Close,EMALong ));

Plot( EMA ( Close,2 ),"Short EMA", colorGreen, styleThick ); 
Plot( EMA ( Close,10 ),"Long EMA", colorRed, styleThick ); 
Plot( StochFinal ,"Period", colorGreen, styleThick ); 

/* max loss stop optimization */

ApplyStop(stopTypeLoss, 
         stopModePercent, 
         Optimize( "max. loss stop level", 2, 2, 10, 2 ), 
                        2,
         False );

What do I need to do to make sure:

1.  All buys and sells are done as CLOSE+1 (I only use EOD data for mutual 
funds).
2.  Make sure stops are triggered based on the purchase price, not the price on 
the -1 signal date.

Right now, under settings, I have Buys and Sells set to CLOSE +1.

Thanks!

--- In [email protected], "Mike" <sfclimb...@...> wrote:
>
> Hi,
> 
> Since you are trading the Close, you could simplify your life by following 
> one of the well defined scenarios from the ApplyStop documentation:
> 
> http://www.amibroker.com/guide/afl/afl_view.php?id=20
> 
> In your case, follow scenario 2 and take your trades based on yesterday's 
> signal.
> 
> e.g.
> 
> SetTradeDelays(0, 0, 0, 0);
> 
> Trigger = ...;
> Buy = Ref(Trigger, -1);
> BuyPrice = Close;
> 
> Your signal still shows up Monday night. But, you don't act on it until 
> Tuesday Close. That's what you're doing in real life anyway, so just make 
> your code show the same.
> 
> Mike
> 
> --- In [email protected], "graphman27" <steve@> wrote:
> >
> > Question:  When stops are coded afl instead of setup under settings, do 
> > they disregard the system settings for Buy Price and Buy Delay?   
> > Currently, I have the latter set to Buy Price = Close+1 Day Buy Delay.  For 
> > a new strategy I am working on, I notice that during live testing something 
> > doesn't jive.  Here is an example...
> > 
> > Note:  I always use EOD data and CLOSE +1, to get "tradable" signals for 
> > mutual funds and indices:
> > 
> > Monday Night:  Formula gave buy signal for Emerging Markets after the 
> > close.  With CLOSE+1 Day delay, that would mean buy at Tuesday's Close.
> > 
> > Tuesday Night:  Max Loss Stop is triggered because of a -3.5% drop in the 
> > Emerging Markets on Tuesday.
> > 
> > Wednesday at the close, mutual fund is sold.
> > 
> > Question:  How could a Max Loss Stop be triggered if that fund wasn't 
> > purchased until AFTER Tuesday's big drop?  Since it was purchased AFTER the 
> > drop, there was no loss of -3.5% going into Wednesday.
> > 
> > Here is an example of a typical mutual fund compatible coded stop:
> > 
> > ApplyStop(stopTypeLoss, 
> >          stopModePercent, 
> >          Optimize( "max. loss stop level", 2, 2, 10, 2 ), 
> >          False );
> > 
> > Do I have to code something else to make sure the STOP is triggered based 
> > on the CLOSE+1 purchase price and NOT the BUY SIGNAL Price?  Or, do I need 
> > to code the Buys and Sells inside the formula as CLOSE+1 instead of relying 
> > on system settings?  OR, none of the above?
> > 
> > Thanks in advance for your help, as usual!
> > 
> > Steve.
> >
>


Reply via email to