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 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
      132 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