• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLongStop acting strangely in backtesting

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

    ExitLongStop acting strangely in backtesting

    Hi,

    I am not sure why this happened once in a backtest. Enclosed is a screenshot. In almost all backtested trades, the ExitLongStop acted the way it was supposed to and got out at 2 points below the entryprice. However, there is one instance in the backtest where it exits at 11.25 points below the entryprice making my partner very uncomfortable in going live with this system. Below is some example code where I utilize this exit with the entry logic stripped (I just say if (x)). I am not sure why this happened once in the backtest and assume there is something I did incorrectly with the ExitLongStop and it is suttle as I looked over the help examples and the function signature and can't seem to find what I did wrong. Any help is appreciated. Here is my sample code:


    Thank you,
    David




    DStop=2.00;


    if(x)
    {
    EnterLong("By");
    }

    if(Position.MarketPosition == MarketPosition.Long)
    {

    double DStop = Position.AvgPrice-stop;


    ExitLongStop(DStop,"By");

    }
    Attached Files

    #2
    Hello Cowpux,

    Thank you for your post.

    You would want to use TickSize and multiply this for the appropriate point size. For the ES there is 4 ticks to the point, so you could do the following:
    Code:
    double DStop = Position.AvgPrice - ((stop*4)*TickSize);
    For information on TickSize please visit the following link: http://www.ninjatrader.com/support/h...7/ticksize.htm
    Patrick H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Atilla, Today, 04:05 PM
    0 responses
    10 views
    0 likes
    Last Post Atilla
    by Atilla
     
    Started by Displacer, Today, 02:57 PM
    2 responses
    13 views
    0 likes
    Last Post Displacer  
    Started by SAILIKITY, 05-22-2019, 05:41 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by rmillar, 01-09-2019, 06:02 PM
    6 responses
    71 views
    1 like
    Last Post eDanny
    by eDanny
     
    Started by mlarocco, Today, 11:39 AM
    4 responses
    23 views
    0 likes
    Last Post mlarocco  
    Working...
    X