Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit on close

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

    Exit on close

    I have problems with my strategy some times when a position is exit on close.
    In the attached chart I have the same trade Historical (left) and real time (right).
    I can’t find the problem within the code, if there was a problem with my code The exit should be the same in both charts.

    Any advice??
    Thank you

    protectedoverridevoid Initialize()
    {
    CalculateOnBarClose =
    true;
    EntriesPerDirection =
    10;
    EntryHandling = EntryHandling.AllEntries;
    EMA(E_Fast).Plots[
    0].Pen.Color = Color.Orange;
    EMA(E_Slow).Plots[
    0].Pen.Color = Color.Green;
    Add(EMA(E_Fast));
    Add(EMA(E_Slow));
    Add(anaSuperTrend(m_Mult,m_ATRPeriod,m_Median));
    }


    ////////////////////METHODS FOR LONGS
    privatevoid GoLongA()
    {
    SetStopLoss(
    "target1A", CalculationMode.Price, Close[0] - (StopA*TickSize), false);
    SetStopLoss(
    "target2A", CalculationMode.Price, Close[0] - (StopA*TickSize), false);
    SetStopLoss(
    "target3A", CalculationMode.Price, Close[0] - (StopA*TickSize), false);

    SetProfitTarget(
    "target1A", CalculationMode.Price, Close[0] + (Target1A*TickSize));
    SetProfitTarget(
    "target2A", CalculationMode.Price, Close[0] + ((Target1A + Target2A)*TickSize));
    SetProfitTarget(
    "target3A", CalculationMode.Price, Close[0] + ((Target1A + Target2A + Target3A)*TickSize));

    entryOrderA = EnterLong(
    "target1A");
    EnterLong(
    "target2A");
    EnterLong(
    "target3A");




    }
    Attached Files

    #2
    robe2010, from a quick look the issue should not be code related here : was execution received in realtime done on a live or sim account? Is the session template and ExitOnClose seconds set identically as in the backtest?

    Comment


      #3
      Bertrand,

      a execution was rceived in real time in a demo account.

      session templete and ExitOnClose seconds are set identically.

      Thanks for you help .
      Attached Files

      Comment


        #4
        robe2010, you're welcome - are you sure the demo account would provider live data and that your PC clock stamping the executions would be in sync and up to date?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X