Crosses over vs. “>”

Forums ProRealTime English forum ProOrder support Crosses over vs. “>”

  • This topic has 5 replies, 3 voices, and was last updated 6 months ago by avatarkt.
Viewing 6 posts - 1 through 6 (of 6 total)
  • #222933
    kt

    Hi Experts,

    I could use some assistance in comprehending the outcomes produced by various entry and exit coding strategies. I learned this lesson the hard way, incurring significant losses because my initial code failed to trigger an exit from the market. My primary question is, “What accounts for the discrepancy in results between option #1 and options #2 & 3?” In Result A, I achieved the intended clean entry and exit, while Result B did not meet my expectations

    // Universal codes for all options =================
    timeframe(30 minute, updateonclose)
    sp050a = supertrend[0.5,336]

    timeframe(default) // Default is a timeframe that is less than 30-min, e.g. I ran the program at one min
    sp050ad = supertrend[0.5,10]

    // Option #1, Result A (see picture attached) =============
    longentry =   close > sp050a and close crosses over sp050ad.  // buy at market
    longx =  close < sp050a.  // sell at market

    // Option #2, Result B (see picture attached ) =================
    timeframe(default)
    longentry =   close > sp050a and close > sp050ad
    longx =  close crosses under sp050a

    // Option #3, Result B (see picture attached) ==========
    longentry =   close > sp050a and close > sp050ad
    longx =  close < sp050a

    #222936
    kt

    Sorry, my inquiry in the 1st post isn’t clear.  Adding on to the post and new attachments.

    // Opt A: Result AA. Good
    longentry = close > sp050a and close > sp050ad. // buy
    longx = close crosses under sp050a  // sell

    // Opt B: Result BB. Bad
    longentry = close > sp050a and close > sp050ad
    longx = close < sp050a

    #222943

    From the Topic title …

    1.  Crosses Over = True in 1 bar ONLY and needs Crosses Under = True before Crosses Over = True again.

    2.  > = True in 1 bar AND True for every bar following until < = True.

    Hope above helps a bit?

     

    #222944
    kt

    Hi Grahal,

    Understand, but it doesn’t explain the situation I encountered.

    The following did not Exit the position in real trade and in simulation, although the price has gone way way down below the sp050ad price indicator.  Fyi, I’m seeing a 1/10 of my money vanished after I woke up the next morning 🙁   e.g.  I entered a Long and now the price had gone way way way way down and yes, it still hasn’t exit.

    longentry = close > sp050a and close > sp050ad
    longx = close < sp050ad

    #222945

    longx = close < sp050ad means that at closing time the CLOSE is tested agains SP050AD and the trade closed if below.

    It may have happened, especially in case of higher timeframes, that the LOW has gone much lower than sp050ad  but a retracement has caused the price to rise again to a level ABOVE or EQUAL to sp050ad. Thus the trade has not been closed.

    You may replace the above statement with longx = LOW < sp050ad, or use pending orders to exit at the desired price level live (while the candle is being formed), without waiting for a candlestick to close.

     

    #222947
    kt

    Hi Roberto,

    The issue has been resolved; thank you for your help. I suspect that the buy and sell indicators at my specified price level, using Supertrend with an ATR of 0.5 in this case, might have caused confusion within the system. It seems that the conditions aligned for both buy and sellshort (or sell and exitshort) simultaneously, which may have hindered the system’s actions. As an alternative approach, I am considering adjusting the Supertrend ATR to 0.45. This has been an enlightening lesson for me.

    Thanks All!

Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:

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