// Downloaded From https://www.WiseStockTrader.com
L_Condi1 = ROC( Close, 200 ) > 0 ;
lRSI=20;
L_RSI=3;
L_Condi2 = RSI( L_RSI ) > 0 AND RSI(L_RSI ) < lRSI ;
AddColumn( RSI( L_RSI), "RSI" );
S_Condi1 = ROC( Close, 200 ) < 0 ;
HRSI=95;
S_Condi2 = RSI( 3 ) > HRSI;
TStop = 0;
Lp=0.07;
B_LP_C = Ref( C, -1 ) - ( Ref( C, -1 ) * Lp ); //buyprice x% under the last close
AddColumn( Ref( C, -1 ), "V_Close" );
AddColumn( B_LP_C, "BuyPrice" );
LONG_C = ( Ref( L_Condi1, -1 ) AND Ref( L_Condi2, -1 )AND L < B_LP_C AND Close > 2 AND Ref( Volume, -1 ) > 1 ) ;
AddColumn( LONG_C, "LONG", 1 );
Buy = LONG_C;
BuyPrice = B_LP_C;
sp=0.05;
B_SP_C = Ref( C, -1 ) + ( Ref( C, -1 ) * sp ); //buyprice x% under the last close
Short_C = ( Ref( S_Condi1, -1 ) AND Ref( S_Condi2, -1 ) AND H > B_SP_C AND Close > 2 AND Ref( Volume, -1 ) > 1 );
Short = Short_C;
AddColumn( Short_C, "Short", 1 );
Filter = Long_C OR Short_C; 
IIf( L > B_SP_C,ShortPrice = Open,ShortPrice = B_SP_C);
AddColumn(ShortPrice, "Short_Price" );
MaxLost = 15;
ApplyStop( stopTypeLoss, stopModePercent, MaxLost );//Max - stop LOSS
Sell = Close > Ref( Close, -1 );
Cover = Close < Ref( Close, -1 );
Size = 33;//% of capital
SetPositionSize( Size, spsPercentOfEquity ); // buy Shares max. 50 %
SetBacktestMode( backtestRegularRawMulti ); 
SetTradeDelays(1,1,1,1); 
//PositionSize = 50000;