Automatic system stop

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #199545 quote
    ThaNoizy
    Participant
    New

    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
    
    #199547 quote
    robertogozzi
    Moderator
    Master

    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?

    #199550 quote
    ThaNoizy
    Participant
    New

    Yes that is correct, but when I start the system to trade it gets shut down with an error code saying this:

    Skarmbild-2022-08-24-224600.png Skarmbild-2022-08-24-224600.png
    #199557 quote
    robertogozzi
    Moderator
    Master

    Which is the default timeframe you are using?

    #199559 quote
    ThaNoizy
    Participant
    New

    Default timeframe is 5 minutes.

    #199588 quote
    robertogozzi
    Moderator
    Master

    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.

    #199594 quote
    ThaNoizy
    Participant
    New

    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

    #199595 quote
    ThaNoizy
    Participant
    New

    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?

    #199601 quote
    robertogozzi
    Moderator
    Master

    Yes, you can have multiple strategies running on the same instrument.

    #199623 quote
    ThaNoizy
    Participant
    New

    I still get the error message when the 5 min candle closes

    #203346 quote
    robertogozzi
    Moderator
    Master

    After such a long time a couple of trades were opened, then closed, with no errors.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

Automatic system stop


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
ThaNoizy @thanoizy Participant
Summary

This topic contains 10 replies,
has 2 voices, and was last updated by robertogozzi
3 years, 3 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 08/24/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...