• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 manugarc, Today, 01:15 PM
      0 responses
      0 views
      0 likes
      Last Post manugarc  
      Started by JMont1, Today, 11:42 AM
      0 responses
      4 views
      0 likes
      Last Post JMont1
      by JMont1
       
      Started by ryanmercado, Today, 10:04 AM
      0 responses
      3 views
      0 likes
      Last Post ryanmercado  
      Started by uiwislth, Yesterday, 11:25 PM
      0 responses
      5 views
      0 likes
      Last Post uiwislth  
      Started by Steve L, Yesterday, 10:04 PM
      0 responses
      4 views
      0 likes
      Last Post Steve L
      by Steve L
       
      Working...
      X