ProOrder Strategy Suddenly Stopped Working This Week

Forums ProRealTime English forum ProOrder support ProOrder Strategy Suddenly Stopped Working This Week

Viewing 1 post (of 1 total)
  • #248577

    Hi everyone,

    I'm hoping for some help with a very strange issue. I have a time-based automated strategy in ProOrder that was running perfectly last week. However, as of this Monday, it has completely stopped executing any trades.

    The issue is not a simple error in the code, because even an extremely simple test code, designed to place just one trade at a specific time, also fails to execute. This suggests a more fundamental problem.

    Here is the **minimal test code** that fails to work:

    // Minimal Test Code
    // I set the TargetTime to a few minutes in the future for testing.
    TargetTime = 140000 // e.g., Set to 2:00 PM

    ONCE TradeAttempted = 0

    IF Time >= TargetTime AND TradeAttempted = 0 THEN
    BUY 0.1 CONTRACT AT MARKET
    TradeAttempted = 1
    ENDIF

    For complete context, here is the original, more complex strategy that **was working correctly last week** but now also fails.

    // ProOrder automated trading – USDJPY
    // Time-based entry management
    // Pair: USDJPY
    // Timezone: JST (Japan Standard Time)

    // ===== Main Settings =====
    DEFPARAM CumulateOrders = False // Do not cumulate positions (Important)
    DEFPARAM PreLoadBars = 0 // Minimize pre-loaded bars
    DEFPARAM FlatBefore = 060000 // Flatten before market open
    DEFPARAM FlatAfter = 235900 // Flatten after market close

    // ===== Common Settings =====
    USDJPYEntryTimeWindow = 10 // Entry time window (seconds)
    USDJPYTotalEntries = 13 // Total number of entries

    // ===== Debug Mode =====
    USDJPYDebugMode = 0 // Set to 1 for detailed logs

    // ===== USDJPY Entry Table (in chronological order) =====
    // IMPORTANT: Must be set in chronological order.
    // Times are set in JST.

    // — Entry 1: 08:55:00 BUY —
    USDJPYEntryTime1 = 085500
    USDJPYExitTime1 = 085800
    USDJPYDirection1 = 1 // 1=BUY, -1=SELL
    USDJPYLot1 = 0.1
    USDJPYTP1 = 0 // pips
    USDJPYSL1 = 15 // pips

    // — Entry 2: 09:10:00 BUY —
    USDJPYEntryTime2 = 091000
    USDJPYExitTime2 = 091100
    USDJPYDirection2 = 1
    USDJPYLot2 = 0.1
    USDJPYTP2 = 0
    USDJPYSL2 = 15

    // … (Entries 3 through 12 omitted for brevity) …

    // — Entry 13: 18:53:00 BUY —
    USDJPYEntryTime13 = 185300
    USDJPYExitTime13 = 185800
    USDJPYDirection13 = 1
    USDJPYLot13 = 0.1
    USDJPYTP13 = 0
    USDJPYSL13 = 15

    // ===== State Management =====
    ONCE USDJPYNextEntryIndex = 1 // Index for the next entry to execute
    ONCE USDJPYActiveEntry = 0 // Currently active entry number
    ONCE USDJPYDailyReset = 0 // Daily reset flag
    ONCE USDJPYPositionClosed = 0 // Position closed flag

    // ===== Monitor for Next Entry (only if NOT ONMARKET) =====
    IF NOT ONMARKET THEN
    // Post-close processing
    IF USDJPYPositionClosed = 1 THEN
    USDJPYActiveEntry = 0
    USDJPYPositionClosed = 0
    ENDIF

    // Check for the next entry
    IF USDJPYNextEntryIndex <= USDJPYTotalEntries THEN
    USDJPYCheckEntryTime = 0
    USDJPYCheckDirection = 0
    USDJPYCheckLot = 0

    // Set variables based on entry index
    IF USDJPYNextEntryIndex = 1 THEN
    USDJPYCheckEntryTime = USDJPYEntryTime1
    USDJPYCheckDirection = USDJPYDirection1
    USDJPYCheckLot = USDJPYLot1
    // (ELSIF for entries 2-12 omitted for brevity)
    ELSIF USDJPYNextEntryIndex = 13 THEN
    USDJPYCheckEntryTime = USDJPYEntryTime13
    USDJPYCheckDirection = USDJPYDirection13
    USDJPYCheckLot = USDJPYLot13
    ENDIF

    // Entry time check and execution
    // NOTE: This was failing with both CurrentTime and Time variables.
    IF USDJPYCheckEntryTime > 0 AND CurrentTime >= USDJPYCheckEntryTime AND CurrentTime <= USDJPYCheckEntryTime + USDJPYEntryTimeWindow THEN
    IF USDJPYCheckDirection = 1 THEN
    BUY USDJPYCheckLot CONTRACT AT MARKET
    ELSIF USDJPYCheckDirection = -1 THEN
    SELLSHORT USDJPYCheckLot CONTRACT AT MARKET
    ENDIF
    USDJPYActiveEntry = USDJPYNextEntryIndex
    USDJPYNextEntryIndex = USDJPYNextEntryIndex + 1
    ENDIF

    // Skip if time has passed
    IF USDJPYCheckEntryTime > 0 AND CurrentTime > USDJPYCheckEntryTime + USDJPYEntryTimeWindow THEN
    USDJPYNextEntryIndex = USDJPYNextEntryIndex + 1
    ENDIF
    ENDIF
    ENDIF

    // ===== Position Management =====
    IF ONMARKET AND USDJPYActiveEntry > 0 THEN
    // Get settings for the active entry
    USDJPYMyTP = 0
    USDJPYMySL = 0
    USDJPYMyExitTime = 0

    IF USDJPYActiveEntry = 1 THEN
    USDJPYMyTP = USDJPYTP1
    USDJPYMySL = USDJPYSL1
    USDJPYMyExitTime = USDJPYExitTime1
    // (ELSIF for entries 2-12 omitted for brevity)
    ELSIF USDJPYActiveEntry = 13 THEN
    USDJPYMyTP = USDJPYTP13
    USDJPYMySL = USDJPYSL13
    USDJPYMyExitTime = USDJPYExitTime13
    ENDIF

    // Set TP/SL
    IF USDJPYMyTP > 0 THEN
    SET TARGET PROFIT USDJPYMyTP * PointSize
    ENDIF
    IF USDJPYMySL > 0 THEN
    SET STOP LOSS USDJPYMySL * PointSize
    ENDIF

    // Close by time
    IF CurrentTime >= USDJPYMyExitTime THEN
    IF LONGONMARKET THEN
    SELL AT MARKET
    ENDIF
    IF SHORTONMARKET THEN
    EXITSHORT AT MARKET
    ENDIF
    USDJPYPositionClosed = 1
    ENDIF
    ENDIF

    // ===== Daily Reset =====
    // Reset at 00:00 server time
    IF Hour = 0 AND Minute = 0 AND USDJPYDailyReset = 0 THEN
    USDJPYNextEntryIndex = 1
    USDJPYActiveEntry = 0
    USDJPYPositionClosed = 0
    USDJPYDailyReset = 1
    ENDIF

    // Clear reset flag after 00:01
    IF Hour > 0 OR Minute > 0 THEN
    USDJPYDailyReset = 0
    ENDIF

    The main question remains: why would both a complex, previously-working strategy AND a minimal test strategy suddenly stop working this week?

    Has anyone else experienced this? Any ideas or known platform issues would be greatly appreciated.

     

Viewing 1 post (of 1 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login