On off stop switch

Hello,

how can I program an on off switch for a stop

Stopeinsatz= 1; // 1 = on / 0 = 0ff
StopCalculation = ValueWhen( Buy, 3 * ATR( 21 ), 1 );
IIf(Stopeinsatz==1,ApplyStop( stopTypeLoss, stopModePoint, StopCalculation ), !StopCalculation);

This code is not working for entry stop. 1 = use stop 0 = don´t use stop
Thanks for any help.

Stopeinsatz= 1; // 1 = on / 0 = 0ff
StopCalculation = ValueWhen( Buy, 3 * ATR( 21 ), 1 );

if( Stopeinsatz ) 
{
  Sell = 0;
  ApplyStop( stopTypeLoss, stopModePoint, StopCalculation );
}
else
{
  Sell = //...something else here
}
4 Likes

thanks. :smiley: it works.