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

[amibroker] Re: Help with valuewhen and trough: (continued)



PureBytes Links

Trading Reference Links


Graham and others

OK,

I have finally twigged on to this.

> b = Cross(C,EMA(C,30));
> Y = ValueWhen(B,Trough(L,1,2),1);
> 
> Plot(Close,"close",colorBlack,64);
> Plot(EMA(C,30),"ema 30",colorBlue,1);
> Plot(Zig(L,1),"zig",colorGold,1);
> Plot(y,"VALUEWHEN BUY",colorOrange, 1 | styleThick);
> 
> > Do you get additional buy signals after the initial
> > one, if so these
> > will reset your sell condition

I did not realise that this is a function of the ValueWhen command:

Y = ValueWhen(B,Trough(L,1,2),1);RESETS every time there is a new buy
condition. (See http://groups.yahoo.com/group/amibroker/message/48793)

I want to keep this value fixed as explained in earlier post.

So what I have come up with is to also use the Lastvalue() function:

Buy = Cross(C,EMA(C,30));
Y = ValueWhen(Buy,Trough(L,1,2),1); // this should stop Y from
//changing value when there are new buy signals.
Y = LastValue(y,1);

Sell = Cross(y,Close);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Plot(Close,"close",colorBlack, 64);
Plot(EMA(C,30),"ema 30",colorBlue,1);
Plot(Zig(L,1),"zig",colorLightBlue,1);
Plot(y,"VALUEWHEN BUY",colorOrange, 1 | styleThick);


PlotShapes(shapeUpArrow * Buy,colorGreen,0);
PlotShapes(shapeDownArrow * Sell,colorRed,0);

NEW QUESTION:

Now if plot this then I see that the second last trough is selected,
*even if it is greater* than the last trough.

See AXA (ASX code) for example. Entry 19 th Jan 2005.
Y plots on the low of the 29 Dec 2004: not what I want.
I want the pivot point low of 8th Dec 2004, because this is the second
lowest trough immediately before the buy signal.

I have posted truff 2.doc in the files section to illustrate what I
want to achieve. 

I have posted truffAXA.png in the files section for those of you who
do not access to ASX data, also to illustrate what I am trying to achieve.

How can I achieve this?

Regards

ChrisB


 
> What I want to do is plot this as a fixed value which
> does *not* change as the price changes.
> 
> I have plotted this as an attempt:
> 
> b = Cross(C,EMA(C,30));
> Y = ValueWhen(B,Trough(L,1,2),1);
> 
> Plot(Close,"close",colorBlack,64);
> Plot(EMA(C,30),"ema 30",colorBlue,1);
> Plot(Zig(L,1),"zig",colorGold,1);
> Plot(y,"VALUEWHEN BUY",colorOrange, 1 | styleThick);
> 
> > Do you get additional buy signals after the initial
> > one, if so these
> > will reset your sell condition
> 
> No, there are no additional buy signals.
> The Y value as indicated above seems to move up and
> down with subsequent price action.
> 
> How do I stop the Y value from moving up or down?
> 
> What function can I use to take the value from Y and
> plot it as a fixed straight line as in
> 
> Plot(1.5, "value",colorred,1); ???
> 
> independent of subsequent price action?
> 
> I am not sure if I am explaining this well.
> Perhaps I should draw this and post the graphic?
> 
> Regards
> 
> ChrisB
>  
> > > Hi All...
> > > 
> > > I want to set my initial hard stop at the second
> > last
> > > pivot point low using the Trough function.
> > > 
> > > This is what I have tried:
> > > 
> > > buy = whatever;
> > > 
> > > initialStop = valuewhen(buy,trough(L,0.5,2),1);
> > > 
> > > sell = cross(initialStop,close);
> > > 
> > > when I test this on an individual stock to check
> > the
> > > exits I find this is not as expected.
> > > I get sell arrows when the close has NOT crossed
> > the
> > > value of initial stop.
> > > 
> > > I want the value of the second last trough at
> > entry to
> > > stay FIXED.
> > > 
> > > Where am I going wrong?
> > > 
> > > How can I code this?
> > > 
> > > Regards
> > > 
> > > ChrisB
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > The all-new My Yahoo! - What will yours do?
> > > http://my.yahoo.com
> > > 
> > > 
> > > Check AmiBroker web page at:
> > > http://www.amibroker.com/
> > > 
> > > Check group FAQ at:
> >
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > -- 
> > Cheers
> > Graham
> > http://e-wire.net.au/~eb_kavan/
> > 
> 
> 
> 
> 	
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - You care about security. So do we. 
> http://promotions.yahoo.com/new_mail





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/