Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple Short High Tick/Buy Low Tick Strategy

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

    Simple Short High Tick/Buy Low Tick Strategy

    I am pretty new to creating strategies so a little help would be appreciated. I am trying to use the Strategy Analyzer and I cannot get this strategy to execute any buys or sells... can someone take a quick look? I am sure I am doing something stupid....

    private bool curLong = true; // Default setting for CurLong
    private bool curShort = true; // Default setting for CurShort
    private bool noPos = true; // Default setting for NoPos
    private double highTickThresh = 600; // Default setting for HighTickThresh
    private double lowTickThresh = -600; // Default setting for LowTickThresh

    protected override void Initialize()
    {
    Add("ES 12-15",PeriodType.Minute,1);
    Add("^TICK",PeriodType.Minute,1);
    CalculateOnBarClose = true;
    CurLong = false;
    CurShort = false;
    NoPos = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Low[1] <= LowTickThresh)
    {
    if (CurShort == true )
    {
    ExitShort();
    CurShort = false;
    }
    if (CurLong == false)
    {
    EnterLong();
    CurLong = true;
    }
    }

    // Condition set 2
    if (High[1] >= HighTickThresh)
    {
    if (CurLong == true)
    {
    ExitLong();
    CurLong = false;
    }
    if (CurShort == false)
    {
    EnterShort();
    CurShort = true;
    }

    }
    }

    #2
    Hello,

    Thank you for the question.

    I would like to check, have you confirmed you have 1 minute data for the series you are adding before testing?

    Additionally have you used Print statements or other debugging techniques to determine where the logic is not being met? If not I would suggest using Print statements first to see if the conditions are being called, if not you could try printing the values for the variables used or the items in the conditions to see what values are being passed. We have a collection of debugging steps located at the following post: http://ninjatrader.com/support/forum...ead.php?t=3418

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you NinjaTrader_Jesse. This was very helpful

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rajendrasubedi2023, Today, 09:50 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by geotrades1, Today, 10:02 AM
      0 responses
      4 views
      0 likes
      Last Post geotrades1  
      Started by ender_wiggum, Today, 09:50 AM
      0 responses
      4 views
      0 likes
      Last Post ender_wiggum  
      Started by bmartz, Today, 09:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by geddyisodin, Today, 05:20 AM
      3 responses
      24 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X