How to remove Buy Signal, when using applystop as a sell (sell=0;)

xxx

Hello,
I try to sell using sell = 0; and use applystop to generate sell action. But it generate noise buy signal(white circle), when i use Buy=Exrem(Buy,sell); it makes the Buy action only 1 time and is still open (because the sell does not occur). here the code

Plot(C, "", colorwhite, styleLine);
Ma2 = EMA(C,68);
Plot(MA2, "", colorYellow, styleLine);
//////////////////////////////////////////////////////////////////////////
Buy   = Cross(C, MA2);
Sell   = 0 ;

//Buy = ExRem(Sell, Buy);

ApplyStop(stopTypeLoss,stopModePercent,Optimize( "max. loss stop level", 2, 2, 30, 1 ),1,0 );
ApplyStop(stopTypeProfit,stopModePercent,Optimize( "max. loss stop level", 2, 2, 30, 1 ),1,0);

PlotShapes (IIf (buy,  shapeDigit1, shapeNone), colorWhite, 0,C, 0 );
PlotShapes (IIf (Sell,  shapeDigit2, shapeNone), colorGreen, 0,C, 0 );

Thank you for your attention. :slight_smile:

Add Equity() not Exrem to evaluate stops.
See ApplyStop() reference.

Plot(C, "", colorwhite, styleLine);
Ma2 = EMA(C,68);
Plot(MA2, "", colorYellow, styleLine);
//////////////////////////////////////////////////////////////////////////
Buy = Cross(C, MA2);
Sell = 0;

loss_amount = Optimize( "max. loss stop amount", 2, 2, 30, 1 );
tgt_amount = Optimize( "profit stop amount", 2, 2, 30, 1 );

ApplyStop(stopTypeLoss,stopModePercent,loss_amount,1,0 );
ApplyStop(stopTypeProfit,stopModePercent,tgt_amount,1,0);

if ( Status("action" ) == actionIndicator ) {
	eq = Equity(1, 0);

	PlotShapes(Buy*shapeDigit1, colorWhite, 0, C, 0 );
	PlotShapes((Sell>0)*shapeDigit2, colorGreen, 0, C, 0 );
}

BTW, there plenty of ApplyStop KB articles and forum threads already.

1 Like

I will search more carefully.
Thank you fxshrat, appreciate it :slight_smile: