Profile Picture

Stop Loss bug (backtesting)

Posted By lexx 7 Years Ago
Message
Posted Thursday February 04 2010
in last beta version of RE positions could be closed at impossible prices outside of the bar, if system by mistake gives an order with stop loss favourable than the open or current price.

(see attach)

Attachments
SL.GIF (427 views, 4.00 KB)
Posted Thursday February 04 2010
This problem has been previously reported and I understand it is being addressed.

(My back test results are seriously affect by this, PL is grossly overstated.........)
Posted Saturday February 13 2010
This is true of ProfitTarget as well...any update if there is a fix or work around.
I believe it is a tough thing to fix for backtests, seem you have to be able to set minimum number of bars
Posted Saturday February 13 2010
This should be fixed in the latest version (RightEdge 2010 RC). What version are you using?

Thanks,
Daniel
Posted Sunday February 14 2010
I am using 2010, but seems like if I do the SystemData.CreateTicksFromBars = false
It fixes the problem
Posted Sunday February 14 2010
The issue where a trade could be outside of the bar's high/low range is supposed to be fixed in RE 2010 RC regardless of what you have CreateTicksFromBars set to. Is this what you saw happening? Can you give more information about what the prices were (for the bar, and for the order submitted).

Thanks,
Daniel
Posted Monday February 15 2010
Does not appear to be fixed
I have a trade occuring on 1/14/2010 ticker symbol CTFO
Avg Entry 8.45, avg exit 9.5

Price was never @ 8.45 on the 14th, but was on the 13th. Possible the bars are confused.

Issue 2 is, my trades are entering and exiting on the same bar. So it buys on 1/14 and sells on 1/14. It can not make that determination based on the information it has.

-Greg
Posted Tuesday February 16 2010
Can you provide the following information?

The date/time the order to open the position was submitted.
The date/time the open position order was filled, and at what price.
Whether the open position order was a market, limit, or stop order, and what the limit/stop price was.

How was the stop loss order submitted? Did you submit it yourself, use SetStopLoss, or did you have a stop loss specified in your system properties or when you called OpenPosition()?

The date/time the stop loss order was submitted.
The stop price for the stop loss order.
The date/time the stop loss order was filled, and at what price.

The open, high, low, close values for all bars between when the open position order was submitted and the stop loss order was filled.

Thanks,
Daniel
Posted Tuesday February 16 2010
here is an easy way to reproduce the bug. run this system against the nasdaq 100 from 1/1/2010 to now. Should profit target on same bar on wrong day. See attachment as well. This was my output

#region Using statements
using System;
using System.Drawing;
using System.Collections.Generic;
using RightEdge.Common;
using RightEdge.Common.ChartObjects;
using RightEdge.Indicators;
#endregion

#region System class
public class MySystem : MySystemBase
{
   public override void Startup()
   {
      // Perform initialization or set system wide options here

   }
}
#endregion

public class MySymbolScript : MySymbolScriptBase
{
   public override void Startup()
   {
      // Perform initialization here.

   }

   public override void NewBar()
   {
       PositionSettings settings = new PositionSettings();
      
                  settings.PositionType = PositionType.Long;                  
                  settings.OrderType = OrderType.Limit;
                  settings.LimitPrice = Bars.Current.Close - .1;               
                  settings.Size = 500;                              
                  settings.ProfitTarget = .005;
                  settings.ProfitTargetType = TargetPriceType.RelativeRatio;
                  settings.BarCountExit = 2;
               //if (!PositionManager.GetOpenPositions(Symbol)) {
                  OpenPosition(settings);
               //}   

   }

   public override void OrderFilled(Position position, Trade trade)
   {
      // This method is called when an order is filled

   }

   public override void OrderCancelled(Position position, Order order, string information)
   {
      // This method is called when an order is cancelled or rejected

   }
}

Attachments
BadResults.zip (339 views, 1.00 KB)
Posted Tuesday February 16 2010
acutally if you set Createticksfrombars = false...the problem goes away. Let me do some more work to reporduce problem


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems