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
