Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I convert / use a 'double' variable with 'Rising / Falling'

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

    How do I convert / use a 'double' variable with 'Rising / Falling'

    I started with an existing Indicator (HMAMultiColoredPlot) that works fine using 'if (Rising(HMA(Period)))' when ploting on the price pane 1.

    I plot a simple MACD crossing over/under an HMA line (named TrendLine) on the price pane & it works great. Now I'm trying to have that same 'TrendLine' line to change colors as it Rises / Falls using the 'Rising' or 'Falling' function.
    if (Rising(TrendLine)) where
    double TrendLine = (HMAvalue + (MACDiffValue * MDiffMult));

    How do I convert 'TrendLine' so I don't have all these errors:
    - Invalid Argument
    -Cannot convert from 'double' to 'NinjaTrader.Data.IDataSeries'
    -Cannot apply indexing with [] to an expression of type 'double'

    I have been using Ninja for 2.5 years but have not Posted very many Threads so if anyone has tips on how to post questions correctly I open to learn that also.
    Attached Files

    #2
    KLG08, currently TrendLine just stores a single value which changes for every bar. You will need to start working with DataSeries and change TrendLine to a DataSeries in order to achieve what you're looking to do. This reference sample, called Using a DataSeries Object to Store Calculations, should help you on your quest.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Austin,thank you for your quick response.

      I tried following the example & cleared up most of the errors but I still come back to the basic 'conversion' problem, & now it says 'cannot convert from 'NinjaTrader.Data.DataSeries' to NinjaTrader.Indicator.IndicatorBase'.

      I'm not sure what to substitute in place of 'new' in the "
      myDataTrendLine =
      new DataSeries(TrendLine); "

      Also not sure what I'm doing wrong when I try to convert my indicator TrendLine into DataSeries.
      Attached Files

      Comment


        #4
        Instead of using this to create the DataSeries:

        myDataTrendLine = new DataSeries(TrendLine);

        try this:

        myDataTrendLine = new DataSeries(this);

        then in code to assign the TrendLine variable value to the DataSeries:

        myDataTrendLine.Set(TrendLine);
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #5
          Thank you eDanny and NinjaTrader_Austin for your help it works.
          Last edited by KLG08; 03-27-2010, 07:57 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Frank1000, Today, 03:05 AM
          1 response
          4 views
          0 likes
          Last Post NT-Roland  
          Started by sinpeople, Today, 07:20 AM
          0 responses
          2 views
          0 likes
          Last Post sinpeople  
          Started by ntdev, Today, 01:14 AM
          4 responses
          16 views
          0 likes
          Last Post ntdev
          by ntdev
           
          Started by ct, Today, 02:22 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by yodaler, Yesterday, 06:12 PM
          4 responses
          13 views
          0 likes
          Last Post NinjaTrader_Jason  
          Working...
          X