I want the system to buy when
Condition 1 - the price is above its 200 moving day average
Condition 2 - the RSI dips below or is equal to 5
Close the position when the price crosses above its 5 day moving average.
I want the system to sell when
Condition 1 - The price is below its 200 moving day average
Condition 2 - The RSI dips above or is equal to 95
Close the position when the price crosses under its 5 day moving average.
RSI period 2
Where as the below code waits till the next day to open and close a position I need it to do the very next day.
Can you help?
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = close
indicator2 = Average[200](close)
c1 = (indicator1 > indicator2)
indicator3 = RSI[2](close)
c2 = (indicator3 <= 5)
IF c1 AND c2 THEN
BUY 2 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator4 = close
indicator5 = Average[5](close)
c3 = (indicator4 CROSSES OVER indicator5)
IF c3 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator6 = close
indicator7 = Average[200](close)
c4 = (indicator6 < indicator7)
indicator8 = RSI[2](close)
c5 = (indicator8 >= 95)
IF c4 AND c5 THEN
SELLSHORT 2 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator9 = close
indicator10 = Average[5](close)
c6 = (indicator9 CROSSES UNDER indicator10)
IF c6 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
Condition 1 - the price is above its 200 moving day average
Condition 2 - the RSI dips below or is equal to 5
Close the position when the price crosses above its 5 day moving average.
I want the system to sell when
Condition 1 - The price is below its 200 moving day average
Condition 2 - The RSI dips above or is equal to 95
Close the position when the price crosses under its 5 day moving average.
RSI period 2
Where as the below code waits till the next day to open and close a position I need it to do the very next day.
Can you help?
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = close
indicator2 = Average[200](close)
c1 = (indicator1 > indicator2)
indicator3 = RSI[2](close)
c2 = (indicator3 <= 5)
IF c1 AND c2 THEN
BUY 2 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator4 = close
indicator5 = Average[5](close)
c3 = (indicator4 CROSSES OVER indicator5)
IF c3 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator6 = close
indicator7 = Average[200](close)
c4 = (indicator6 < indicator7)
indicator8 = RSI[2](close)
c5 = (indicator8 >= 95)
IF c4 AND c5 THEN
SELLSHORT 2 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator9 = close
indicator10 = Average[5](close)
c6 = (indicator9 CROSSES UNDER indicator10)
IF c6 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets