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.

    Comment


      #3
      Thank you NinjaTrader_Jesse. This was very helpful

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      133 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X