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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        50 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        16 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X