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

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 cre8able, Today, 01:16 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by chbruno, 04-24-2024, 04:10 PM
          3 responses
          48 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by samish18, Today, 01:01 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by WHICKED, Today, 12:56 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by WHICKED, Today, 12:45 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X