Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Switch candle patterns on optimisation

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

    Switch candle patterns on optimisation

    I am trying to create a candlestick program that uses switch during optimisation. I attach the candlestick database that for simplicity contains only 2 patterns but will include around 40 when finished. The indicator built from a ninjatrader indicator works and identifies the Candlesticks correctly giving a result for each case of PatternFound[0]=1

    The idea is the indicator will be called by the strategy and each case will be 1 to say 40 and then will be one of the parameters that change by one (integer) as the strategy is optimised (leaving aside each strategy will also have other parameters).

    Currently the code with which I have tried to call the indicator ShortCandleBase (candle database), but is not working, is:


    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1)
    return;

    if (Position.MarketPosition == MarketPosition.Flat
    && ShortCandleBase (1).PatternFound[0] == 1)
    {
    EnterLong(1, "");
    }

    }

    This would then need to be changed to have an input parameter for the ShortCandleBase reference, which is currently 1 (could have been the other pattern or 2 and eventually contain many patterns.



    Many thanks for any help anyone can give
    Attached Files

    #2
    Hello fluke,

    Thank you for your note.

    Would you please provide more information by what you mean does not work? If you create a user input in your strategy similar to how you created the Pattern input in your indicator, and pass this to ShortCandleBase(Pattern).PatternFound[0]==1) does the optimizer optimize this variable?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan
      resolved I was expecting it to show up on the chart. It was not doing so but it works in the strategy analysis and the chart in that analysis

      Yes my original code included "Pattern" and that was used to optimise.

      Sorry!!!
      Last edited by fluke; 08-20-2018, 04:19 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      134 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      118 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X