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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        388 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        260 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        218 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        302 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        268 views
        0 likes
        Last Post CarlTrading  
        Working...
        X