Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 inanazsocial, Today, 01:15 AM
      0 responses
      1 view
      0 likes
      Last Post inanazsocial  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      5 responses
      22 views
      0 likes
      Last Post trilliantrader  
      Started by Davidtowleii, Today, 12:15 AM
      0 responses
      3 views
      0 likes
      Last Post Davidtowleii  
      Started by guillembm, Yesterday, 11:25 AM
      2 responses
      9 views
      0 likes
      Last Post guillembm  
      Started by junkone, 04-21-2024, 07:17 AM
      9 responses
      70 views
      0 likes
      Last Post jeronymite  
      Working...
      X