Hey, I need help! My system stops on every candle close and I don’t know what the problem is, maybe you can find what is causing the error, thanks!
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
DEFPARAM Preloadbars = 10000
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 150000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 230000
timeEnterAfter = time < noEntryAfterTime
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
timeframe(4 hours,updateonclose)
MA200 = average[200]
MA50 = average [50]
bulltrend = MA200<MA50
//"default" timeframe (the timeframe you will launch the strategy on)
timeframe(default)
// Conditions to enter long positions
indicator1 = RSI[9](close)
c1 = (indicator1 < 33)
indicator2 = Stochastic[14,3](close)
c2 = (indicator2 < 20)
indicator3 = Average[3000](close)
indicator4 = Average[750](close)
c3 = (indicator3 <= indicator4)
indicator5 = Average[250](close)
indicator6 = Average[3000](close)
c4 = (indicator5 > indicator6)
c5 = (close <= DHigh(1))
IF (c1 AND c2 AND c3 AND c4 AND c5) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry AND bulltrend THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator7 = RSI[9](close)
c6 = (indicator7 >= 79)
indicator8 = Stochastic[14,3](close)
c7 = (indicator8 >= 80)
indicator9 = Stochastic[14,3](close)
indicator10 = Average[4](Stochastic[14,3](close))
c8 = (indicator9 > indicator10)
indicator11 = Average[4](Stochastic[14,3](close))
c9 = (indicator11 >= 80)
IF c6 AND c7 AND c8 AND c9 THEN
SELL AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 60
You set the conditions to exit at lines 43-51, if they are met then at line 54 your trade wikk be exited.
Are they correct?
When do you want to exit?
Yes that is correct, but when I start the system to trade it gets shut down with an error code saying this:
Which is the default timeframe you are using?
Default timeframe is 5 minutes.
I started your strategy on DAX €5, 5-minute TF and it’s been running smoothly since a few bars (no trade has been opened so far).
I will keep it running a few more hours, though.
Okey, the instrument that I have it on is the Nasdaq 5 Minutes but that doesn’t matter maybe? I will try to start it again in a few hours when I get back home
By the way, I do have another system running on the same instrument but another timeframe but you are able to run more than 1 system on each instrument right?
Yes, you can have multiple strategies running on the same instrument.
I still get the error message when the 5 min candle closes
After such a long time a couple of trades were opened, then closed, with no errors.