Johnson, this is the code for the basic strategy. Let me know how it turns out.{ RSI2_V1.0 Basic RSI(2) strategy: Buy when RSI(2)<10 and sell when RSI(2)>80 }input: RSILen( 2 ), BuyZone( 10 ), SellZone( 80 ); Variables: MyRSI( 0 ); MyRSI = RSI(Close, RSILen) ; // Long Entry if CurrentBar > 1 and MyRSI Crosses Below BuyZone Then Buy ("RSILE") Next Bar at Market ; // Exit Long Position If marketPosition = 1 and MyRSI Crosses Above SellZone then Sell ( "RSILX" ) Next Bar at Market ;
Post a Comment
1 comment:
Johnson, this is the code for the basic strategy. Let me know how it turns out.
{ RSI2_V1.0 Basic RSI(2) strategy: Buy when RSI(2)<10 and sell when RSI(2)>80 }
input: RSILen( 2 ),
BuyZone( 10 ),
SellZone( 80 );
Variables: MyRSI( 0 );
MyRSI = RSI(Close, RSILen) ;
// Long Entry
if CurrentBar > 1 and MyRSI Crosses Below BuyZone Then
Buy ("RSILE") Next Bar at Market ;
// Exit Long Position
If marketPosition = 1 and MyRSI Crosses Above SellZone then
Sell ( "RSILX" ) Next Bar at Market ;
Post a Comment