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

[amibroker] Plotting an Overlay Buy/Sell - Stop Multiple Buys



PureBytes Links

Trading Reference Links

I am plotting an overlay on a chart to indicate BUY/SELL signals. 
Based on what I have I can generate more than one BUY or SELL signal 
in a row. This is not an issue. The issue is that I only want to plot 
the BUY if the last signal was a SELL. Or plot a SELL if the last 
signal was a BUY. 

I only want to plot the first Buy or Sell Arrow. I have tried using 
BarsSince() but I cannot since BUY has to be initialized first.

Here is the chunk of code for a just started swing system.

--------------------------------------------------------------
Buy = C>O AND Ref(C,-1) > Ref(O,-1) AND Ref(C,-2) > Ref(O,-2);
Sell= C<O AND Ref(C,-1) < Ref(O,-1) AND Ref(C,-2) < Ref(O,-2);

//Up until the new signal these will show how many bars. 
//How do I test this before? I tried use temporary vars that I
//Initialized to hold the buy/sells but it does not work.

//the next signal is generated above? 
"BarsSince BUY :" + WriteVal(BarsSince(Buy ));
"BarsSince SELL :" + WriteVal(BarsSince(Sell)); 

Short = Sell;
Cover = Buy;

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

Thank you,
Patrick


------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/