Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

no result showing

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

    no result showing

    tring to build a strategy based on Bill William's indicator called Fractal. the are two plots in this indicator, plot1 indicates up fractal, the second one indicates down fractal.
    what's wrong with my code
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Current[0] > Fractals().Plot1[0]
    && High[1] < Fractals().Plot1[0]
    && Low[1] < Fractals().Plot1[0]
    && High[2] < Fractals().Plot1[0]
    && Low[2] < Fractals().Plot1[0]
    && High[3] < Fractals().Plot1[0]
    && Low[3] < Fractals().Plot1[0])
    {
    EnterLongStopLimit(DefaultQuantity, 0, 0, "");
    }
    Attached Files

    #2
    Hello,

    Thank you for the post.

    I wouldn't be sure from just the image but if there is no result, it is very likely the condition is not becoming true.

    Have you tried to Print the values you are using to see if the condition can become true on the bars you expect?

    If not, I would suggest trying to print something like the following:

    Code:
    protected override void OnBarUpdate()
    {
       Print("Time: " + Time[0] + " " + Current[0] + " > " +  Fractals().Plot1[0]);
    
       if (Current[0] > Fractals().Plot1[0]
    && High[1] < Fractals().Plot1[0]
    && Low[1] < Fractals().Plot1[0]
    && High[2] < Fractals().Plot1[0]
    && Low[2] < Fractals().Plot1[0]
    && High[3] < Fractals().Plot1[0]
    && Low[3] < Fractals().Plot1[0])
    {
    EnterLongStopLimit(DefaultQuantity, 0, 0, "");
    }
    
    }
    I only included one part of your condition in the print to keep this short, but you could add in each of the variables used in the condition to Print for each bar to know if the condition should be true or not. This is the first step I would suggest in locating the reason.



    I look forward to being of further assistance.

    Comment


      #3
      here is the code for fractal, am i using wrong name for Plots?

      #region Using declarations
      using System;
      using System.Diagnostics;
      using System.Drawing;
      using System.Drawing.Drawing2D;
      using System.ComponentModel;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Data;
      using NinjaTrader.Gui.Chart;
      using NinjaTrader.Gui.Design;
      #endregion

      // This namespace holds all indicators and is required. Do not change it.
      namespace NinjaTrader.Indicator
      {
      /// <summary>
      /// Fractals
      /// </summary>

      [Description("Fractal Technical Indicator it is a series of at least five successive bars, with the highest HIGH in the middle, and two lower HIGHs on both sides. The reversing set is a series of at least five successive bars, with the lowest LOW in the middle, and two higher LOWs on both sides, which correlates to the sell fractal. The fractals are have High and Low values and are indicated with the up and down arrows.")]
      [Gui.Design.DisplayName("Fractals (by Bill Williams)")]
      public class Fractals : Indicator
      {
      #region Variables
      private int barcounter = 0;
      private Color upcolor = Color.Green;
      private Color downcolor = Color.Red;
      private System.Drawing.Font textFont;
      #endregion

      int tick_multiply = 0;
      protected override void Initialize()
      {


      Add(new Plot(downcolor, PlotStyle.Dot, "Low Pivot"));
      Add(new Plot(upcolor,PlotStyle.Dot,"High Pivot"));

      Plots[0].Pen.Width = 0.7F;
      Plots[1].Pen.Width = 0.7F;

      CalculateOnBarClose = false;
      Overlay = true;
      PriceTypeSupported = false;
      }

      protected override void OnBarUpdate()
      {

      if(CurrentBar <= 7)
      return;
      if(FirstTickOfBar)
      barcounter++;

      isLowPivot(2);
      isHighPivot(2);

      Comment


        #4
        Hello,

        Thank you for the reply.

        I am unable to see the plot names from what you have posted, but if this is the same indicator as: https://ninjatrader.com/support/foru...3&postcount=36

        The plot names would be plot0 and plot1.

        What was the result of Printing the values you use in the condition, were you able to see the values being used?

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X