Hi All,
I have the following system, in which the sell condition is not equal to short, and the cover condition is not equal to buy. When I try to display the signal on the price chart, the buy-sell signal is overlapping with the short-cover signal. May I have some advice here how I can remove those incorrect signals?
Thanks!
//////////////////////To plot the price/////////////////////////////////////////////
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) \n {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
/////////////////////////////////////////////////////////////////
SetOption( "ReverseSignalForcesExit", False );
Buy = Ref(H,-2) > Ref(H, -1) ;// AND Timecon;
Short = Ref(L,-2) < Ref(L, -1) ;// AND Timecon;
Sell = Cross(MA(O, 10), MA(O, 5));
Cover = Cross(MA(O, 5), MA(O, 10));
Plot(MA(O, 10), "\n MA(O, 10)", colorRed,styleLine);
Plot(MA(O, 5), "\n MA(O, 10)", colorBlue,styleLine);
Buy=ExRem(Buy,Sell); //<--
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short); //<-- not necessary when using loop to generate every single in/out signal
FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status("LastVisibleBar");
for( i = Firstvisiblebar; i <= Lastvisiblebar AND i < BarCount; i++)
{
if( Buy [ i ]) PlotText( "Buy\n"+NumToStr(BuyPrice[i], 1.4) , i, BuyPrice[i], colorWhite, colorBlack, yoffset = 55 );
if( Sell [ i ]) PlotText( "Sell\n" +NumToStr(SellPrice[i], 1.4), i, sellPrice[i], colorWhite, colorBlack, yoffset = 55 );
if( Short [ i ]) PlotText( "Short\n" +NumToStr(ShortPrice[i], 1.4), i, shortPrice[i], colorWhite, colorBlack, yoffset = -55 );
if( Cover [ i ]) PlotText( "Cover\n"+NumToStr(CoverPrice[i], 1.4) , i, coverPrice[i], colorWhite, colorBlack, yoffset = -55 );
}