Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Struggling with a simple one alert strategy !

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

    Struggling with a simple one alert strategy !

    Hi,

    I'm struggling with a really simple alert strategy.
    It's based on Ichimoku indicator found here.
    I used condition builder to alert me when chikou crosses kijun. As Chikou is drawn 26 bar ago in the chart, I can't get the alert to work good, My strategy alerts me at wrong places. I tried to change 'bars ago' and 'lookback' on either parameters with the same wrong result.
    Please help me





    /// </summary>
    protected override void Initialize()
    {

    CalculateOnBarClose = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (CrossAbove(IchimokuCloud(9, 26, 52).ChikouSpan, IchimokuCloud(9, 26, 52).KijunSen, 1))
    {
    Alert("MyAlert0", Priority.High, "Chikou crosses Kijun", "", 10, Color.White, Color.Black);
    }

    }

    #region Properties
    #endregion
    }
    }

    #2
    Hello EURLSD,

    Thanks for your post.

    You will not be able to use the wizard to get you all the way there but you can uses it to generate most of the code.

    Generally what you want to do is to compare the current value of the ChikouSpan[0] to the KijunSen[26] of 26 bars ago and also check the previous value of each as you won't be able to use the crossabove/below.

    Please see the attached screenshot of the conditions builder. Basically with the two statements we are testing to see if ChikouSpan has crossed above KijunSen. The action then draws a dot on KijunSen[26] bars ago.

    After you have created the conditions (and your actions) for both cross above and crossbelow in the wizard, you will need to unlock the code and after OnBarUpdate, add the following:

    if (CurrentBar < 27 ) return; // Make sure we have enough bars before looking back 26

    If you do not add the above code the strategy will error out. NOTE: Added code snippet to show both sides, with dots, with alerts and with CurrentBarCheck.

    Please let me know if I can be of further assistance.
    Attached Files
    Last edited by NinjaTrader_PaulH; 05-19-2015, 11:43 AM.

    Comment


      #3
      Thank you Paul.Your trick works great !
      Now, I would like to get the result of this crossing so I could use it with the Market Analyser. Like 1 if crossed, 0 if not. Can you help me to implement this please ?

      Comment


        #4
        Convert Strategy to indicator and add output to Market Analyzer

        Hello EURLSD,

        Thanks for your reply and I am glad that helped you.

        Regrettably strategies cannot input to the Market Analyzer.

        To accomplish your goal would require converting your strategy to an indicator then adding modifications to provide an output for the Market Analyzer. The indicator would then be added as a column in the Market Analyzer.

        While we do not provide coding services, in the interest of educational understanding, I have converted the strategy to an indicator and modified it to add the output "ichySignal" where +1 = cross up and -1 = cross down and 0 = no signal.

        Please download and import the indicator EURLSDichyDots. You can then apply the indicator to the Market analyzer. Make sure for the "Plot" that you select IchySignals for the +1, 0, -1.

        If you compare the strategy code to the indicator code you will see much of the code is the same but have added the DataSeries ichySignal and added statements to output those signals. For your understanding what I did was to create a new indicator with the indicator wizard with no plots or lines or inputs which created a basic indicator code shell, I then copied over all of the code between the " { } " in the onbarupdate section from the strategy and placed it in the same onbarupdate section in the new indicator, then added the Dataseries stuff.

        If you want or need other things with the indicator then that will be on you to modify/provide.
        Attached Files

        Comment


          #5
          Thank you so much Paul !
          I'm now able to create my own indicators
          Last edited by EURLSD; 05-22-2015, 03:37 AM.

          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