Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Crossover strategy issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Crossover strategy issues

    Hi, I have a strategy which uses a parabolic SAR crossover as a condition for entry/exit.

    I am seeking to enter a long trade when the Closing PSAR value of the previous bar crosses below the Closing price of the previous bar.

    Instead, now a long trade is being entered when current price rises above the previous period PSAR. It's not logical. Even if it were a "onbarclose" issue, the logical thing to do would be to enter a long order when the current price flips above the current PSAR value.

    However, this is not the case as there is no PSAR indicator value for the current bar (nor are there values for any other technical indicators). The data box shows N/A for the indicator values when I hover over the current bar, implying that the strategy has calculated no such value, and that it is entering long trades when the current price flips above the previous period PSAR (given that current period PSAR) does not exist.

    Can someone offer me some guidance? Here is a snippet of the code.

    if (CrossAbove(Close, ParabolicSAR(BarsArray[1], 0.02, 0.2, 0.02), 1)
    && Position.MarketPosition == MarketPosition.Flat),

    {
    EnterLong(
    1000000, "");
    Variable0 =
    1;
    }

    Many Thanks!

    #2
    skyholder84, you would need to debug the strategy entry condition to see the exact scenario taking place, I would suggest you add prints to see what PSAR value is calcuated at which point and also when your condition then exactly triggers based on the code, then you can review what needs changing to arrive at your desired outcome.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    77 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    45 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    27 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    32 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    63 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X