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

Pnf Help

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

    Pnf Help

    Hi Guys need a little help,

    I have a piece of code which works with time bars and its as follow:

    Code:
                
    else if (State == State.Configure)
                {
                    AddDataSeries(Inst1, BarsPeriodType.Minute, timeframe);/// Leg1   BarsInProgress 1
                    AddDataSeries(Inst2, BarsPeriodType.Minute, timeframe);/// Leg2   BarsInProgress 2
    
                    Leg1 = new Series<double>(this);
                       Leg2 = new Series<double>(this);
                }
            }​
    where timeframe is simply declare above int timeframe = 30;


    Want to change this code to work with PnF chart:
    Code:
    else if (State == State.Configure)
    {
    AddDataSeries(Inst1, BarsPeriodType.PointAndFigure, timeframe);/// Leg1 BarsInProgress 1
    AddDataSeries(Inst2, BarsPeriodType.PointAndFigure, timeframe);/// Leg2 BarsInProgress 2
    
    Leg1 = new Series<double>(this);
    Leg2 = new Series<double>(this);
    }
    }
    ​
    but how do I reference timeframe above now?

    #2
    Hello LakeViewCap,

    To add point and figure charts you can use AddPointAndFigure:

    https://ninjatrader.com/support/help...int+and+figure

    As a side note I see you are using variables for the instrument name and other parameters, keep in mind that will fail in certain use cases. This is documented in all of the Add data pages:

    Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided.
    Arguments supplied to AddPointAndFigure() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello LakeViewCap,

      To add point and figure charts you can use AddPointAndFigure:

      https://ninjatrader.com/support/help...int+and+figure

      As a side note I see you are using variables for the instrument name and other parameters, keep in mind that will fail in certain use cases. This is documented in all of the Add data pages:

      yeah my question is on the "timeframe" variable....


      those vars are hardcoded:

      string Inst1= "NQ MAR24";
      string Inst2= "ES MAR24";​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DJ888, Today, 10:57 PM
      0 responses
      5 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by MacDad, 02-25-2024, 11:48 PM
      7 responses
      158 views
      0 likes
      Last Post loganjarosz123  
      Started by Belfortbucks, Today, 09:29 PM
      0 responses
      7 views
      0 likes
      Last Post Belfortbucks  
      Started by zstheorist, Today, 07:52 PM
      0 responses
      7 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      151 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Working...
      X