I want to share this code with you as i think that can be improved.Please fell welcome to comment and come with more idea .
// Main code : Rsi
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = true//
indicator1=RSI[14](close)
indicator2=RSI[2](close)
//condition to enter long
c1=(indicator2 crosses over indicator1)
c2=(RSI[14](close) > 50)//RSI upward momentum
c3=(RSI[2](close) <70)//RSI downword momentum
c4=(indicator2 crosses under indicator1)
if c1 and c2 then
buy 1 contracts at market
endif
Set target pprofit c3
SET STOP pLOSS c4
//Conditions to enter short
c1=(indicator2 crosses under indicator1)
c2=(RSI[14](close) < 50)//RSI downword momentum
c3=(RSI[2](close) >30)//RSI upword momentum
c4=(indicator2 crosses over indicator1)
if c1 and c2 then
buy 1 contracts at market
endif
Set target pprofit c3
SET STOP pLOSS c4
C3 and C4 will give True / 1 and so can’t be used for Stop values as pProfit and pLoss need to be a value / number of points of price change?
I take it Line 23 is a typo and should be SellShort (not Buy)?
Nice (double) spot GraHal!