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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        68 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        61 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X