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

[amibroker] dividend effects



PureBytes Links

Trading Reference Links

...Never mind, I think I can adjust this to suit:

/* a sample low-level implementation of Profit-target stop in AFL: */
Buy = Cross( MACD(), Signal() );

priceatbuy=0;
for( i = 0; i < BarCount; i++ )
{
if( priceatbuy == 0 && Buy[ i ] ) 
priceatbuy = BuyPrice[ i ];

if( priceatbuy > 0 && SellPrice[ i ] > 1.1 * priceatbuy )
{
Sell[ i ] = 1;
SellPrice[ i ] = 1.1 * priceatbuy;
priceatbuy = 0;
}
else
Sell[ i ] = 0;
}



--- In amibroker@xxxxxxxxxxxxxxx, "Glenn" <glennokb@xxxx> wrote:
> Hi Johsun,
> 
> Thanks for your reply (appreciated), I think the LLV is OK plotted 
> like that as the sell signal is when the todays close goes below 
the 
> previous day LLV as this indicator can move down with the price and 
> not exit if there is no delay.
> 
> This really isn't the problem thought, it's how to use Appystop for 
a 
> Profit Exit. I'm not sure but maybe the BuyPrice is incorrect and 
the 
> Profit exit is not exiting at the correct price but I can't see why.
> 
> The sample setups in the manual doesn't cover what I wanted to do 
as 
> I mentioned in the post.
> 
> Cheers Glenn
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "johsun" <johanskatt@xxxx> wrote:
> > Hi,
> > 
> > Shouldn't the LLV(Low,11) plot be ref(LLV(Low,11),-1) as in your 
> > sell statement?
> > 
> > Thus:
> > Plot(ref(LLV(Low,11),-1),"Trailing Stop",colorRed,1);
> > 
> > JS
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Glenn" <glennokb@xxxx> wrote:
> > > Hello,
> > > 
> > > Just about ready to give up on this., why is THIS profit exit 
so 
> > difficult to 
> > > achieve?
> > > 
> > > I've setup some code, note the following:
> > > 
> > > A. The OPEN price (next day following a Buy signal) is used to 
> > calculate 
> > > the % profit exit from.
> > > 
> > > B. When the CLOSE is above the % profit, EXIT the following day 
> at 
> > the 
> > > OPEN.
> > > 
> > > c. The buy/sells on the chart are the initial signals.
> > > 
> > > The problem is that there are some days where the signals are 
the 
> > > wrong days and I can't figure out why  ie: exits before the 
close 
> > is above 
> > > the profit exit (but not the LLV exit).
> > > 
> > > Any idea why pleeease?
> > > 
> > > //---------------------------8<---------------------------------
--
> > > 
> > > Buy = Cross( MACD(), Signal() );
> > > 
> > > BuyPrice = Ref(Open,1);
> > > 
> > > Sell = Close<Ref(LLV(Low,11),-1);
> > > 
> > > SellPrice = Close;
> > > 
> > > SetTradeDelays(0,0,0,0);
> > > 
> > > ApplyStop(stopTypeProfit,stopModePercent,25,0,False,False);
> > > 
> > > Equity(1);
> > > 
> > > //PLOT
> > > Binary=Ref(Flip(Buy,Sell),-1);
> > > ColProf=IIf(Binary,55,256);
> > > ColMaxL=IIf(Binary,32,256);
> > > Plot(Close,"Close",colorBlack,128);
> > > Plot(LLV(Low,11),"Trailing Stop",colorRed,1);
> > > Plot(ValueWhen(Buy,Ref
> (Open*1.25,1)),"Profit",ColProf,4|2048|4096);
> > > PlotShapes(IIf(Buy,shapeUpTriangle,shapeNone),5,0,L,-10);
> > > PlotShapes(IIf(Sell,shapeDownTriangle,shapeNone),4,0,H,-10);
> > > //---------------------------8<---------------------------------
--


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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/