// jbmarwood.com // Code provided for educational purposes only. // No responsibility shall be accepted for any kind of personal loss. // Please read the full disclaimer at jbmarwood.com/disclaimer SetFormulaName("rsi for stocks"); size1 = 1;//Optimize("size1",15,2,100,2); SetOption( "InitialEquity", 10000); SetOption( "MinShares", 1 ); SetOption( "MarginRequirement", 100); SetOption( "UsePrevBarEquityForPosSizing", True ); SetTradeDelays( 1, 1, 1, 1 ); SetOption( "MaxOpenpositions", size1); SetOption( "AllowSameBarExit", false); Numberpositions = size1; SetOption("Maxopenpositions",numberpositions); SetPositionSize( 1, spsShares ); PositionSize= -100/size1; PositionScore = RSI(14); //* Divergence bulldiv = h>Ref(h,-1) AND RSI(14)Ref(RSI(14),-1); //* Rules Buy = Cross(RSI(14),70); Sell = Cross(RSI(14),30); //Short = Sell; //Cover = Buy; BuyPrice = O; SellPrice = O; //ShortPrice = SellPrice; //CoverPrice = BuyPrice; //Buy = ExRem( Buy, Sell );//*removes extra signals //Sell = ExRem( Sell, Buy ); /////////////////////////////////////////////////////////////////////