Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Target prices Work in Back Test but fail on simulator

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

    Target prices Work in Back Test but fail on simulator

    I have a system that uses the swing high and swing low to calculate fib extension as my target prices, I use 5 Fib numbers to determine my target prices. This works perfectly on multi lot trades for scaling out of positions on the back tests, but when I trade on live data with the simulator, the targets seem to all by pile up on top of each other and all the lots exit just as fast as they executed, the targets print labels so I can see that each target is hit in a fraction of a second, for some reason they do not go to their intended or extended price level. Any Ideas? It seems that if this works on back testing, it would work on live data.

    #2
    We would need to see some code to get an idea what you are doing. Could paste in something?
    RayNinjaTrader Customer Service

    Comment


      #3
      I hope this is enough info... If you need more let me know..


      Variables Section

      // Fibonacci Target Prices
      double[] Fibs=new double[5]{1,1.618,2.618,4.382,7.618};
      double[] Targets=new double[5];



      Risk Management Section
      #region ShortPositions
      if (Positions[0].MarketPosition==MarketPosition.Short)
      {
      mp[0]=-1;

      // Position just changed so Set Target Prices
      if (mp[1]!=-1)
      {
      swinghigh=Swing(3).SwingHigh[0];
      breakpoint=Positions[0].AvgPrice;
      for (int x=0;x<5;x++)
      {
      Targets[x]=breakpoint-Fibs[x]*(swinghigh-breakpoint);
      }

      ShortBE=false;
      ShortTrail=false;
      }

      // Place Stop Loss
      if (Close[0]>=Positions[0].AvgPrice+StopPts)
      {
      try
      {
      Print(ToTime(Time[0]).ToString());
      Print("Short Stop");
      ExitShort();
      }
      catch(Exception ex)
      {
      Print("Short Stop, " + ex.ToString());
      }
      }

      // Place Fib Exit orders
      if (Close[0]<= Targets[0] && Positions[0].Quantity==Num_Cts)
      {
      try
      {
      Print(ToTime(Time[0]).ToString());
      Print("Short Fib Exit1");
      ExitShort(ExitContracts[0],"SFibX1","SE");
      }
      catch(Exception ex)
      {
      Print("Short Fib Exit1, " + ex.ToString());
      }
      }

      if (Close[0]<=Targets[1] && Positions[0].Quantity>Num_Cts-ArraySum(ExitContracts,1))
      {
      try
      {
      Print(ToTime(Time[0]).ToString());
      Print("Short Fib Exit2");
      ExitShort(ExitContracts[1],"SFibX2","SE");
      }
      catch(Exception ex)
      {
      Print("Short Fib Exit2, " + ex.ToString());
      }
      }

      if (Close[0]<=Targets[2] && Positions[0].Quantity>Num_Cts-ArraySum(ExitContracts,2))
      {
      try
      {
      Print(ToTime(Time[0]).ToString());
      Print("Short Fib Exit3");
      ExitShort(ExitContracts[2],"SFibX3","SE");
      }
      catch(Exception ex)
      {
      Print("Short Fib Exit3, " + ex.ToString());
      }
      }

      if (Close[0]<=breakpoint-Targets[3] && Positions[0].Quantity>Num_Cts-ArraySum(ExitContracts,3))
      {
      try
      {
      Print(ToTime(Time[0]).ToString());
      Print("Short Fib Exit4");
      ExitShort(ExitContracts[3],"SFibX4","SE");
      }
      catch(Exception ex)
      {
      Print("Short Fib Exit4, " + ex.ToString());
      }
      }

      if (Close[0]<=breakpoint-Targets[4] && Positions[0].Quantity>0)
      {
      try
      {
      Print(ToTime(Time[0]).ToString());
      Print("Short Fib Exit5");
      ExitShort(ExitContracts[4],"SFibX5","SE");
      }
      catch(Exception ex)
      {
      Print("Short Fib Exit5, " + ex.ToString());
      }
      }

      Comment


        #4
        Target prices Work in Back Test but fail on simulator

        I have some charts here that display a visual of how it should look and what is happening...
        Attached Files

        Comment


          #5
          Someone will follow up on this Monday.
          RayNinjaTrader Customer Service

          Comment


            #6
            metal trader,

            Please try printing out your Swing values for your stops in realtime. Remember, Swing is an indicator that comes back in time and replots itself. This makes it very hard to use in a system going forward.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by warreng86, 11-10-2020, 02:04 PM
            7 responses
            1,360 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Perr0Grande, Today, 08:16 PM
            0 responses
            5 views
            0 likes
            Last Post Perr0Grande  
            Started by elderan, Today, 08:03 PM
            0 responses
            9 views
            0 likes
            Last Post elderan
            by elderan
             
            Started by algospoke, Today, 06:40 PM
            0 responses
            10 views
            0 likes
            Last Post algospoke  
            Started by maybeimnotrader, Today, 05:46 PM
            0 responses
            14 views
            0 likes
            Last Post maybeimnotrader  
            Working...
            X