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

Indicator's plot values are not valid ?

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

    Indicator's plot values are not valid ?

    Hi,

    I am new here. Just trying to design my first strategy.

    I'm just having a hard time trying to access values from MASlopeLine. I doesn't give the same values for the indicator that I see on the chart. I ran the SampleEveryNBar indicator on it and looks like not all values are valid ? Not sure where to go from here.

    I've attached the code and an illustration of what the strategy should do in the case of a Long. Basic logic is : Go long when both MASlopeLines (slow and fast periods) are above their thresholds (20 and 40) and go short (reverse) when both are below (-20 and -40). The values I see in the histogram are the ones I need. If someone can point me in the right direction, I'd appreciate it very much.

    Thank you,

    Pedro
    Attached Files
    Last edited by protrader77; 11-20-2013, 02:29 PM.

    #2
    Hello Pedro,

    Thank you for your post.

    Can you provide the MASlopeLine.cs file as well?

    I look forward to your response.

    Comment


      #3
      Sure, here it is.
      Attached Files

      Comment


        #4
        Hello Pedro,

        Thank you for your response.

        The minimum for the SlopeTest values smallAngle and bigAngle are set to greater values than the defaults you wish to use. Please go to Tools > Edit NinjaScript > Strategy > SlopeTest > Next > Next > set the Min value for the SmallAngle and BigAngle to 1 > Next > Next > Next > Finish.

        Then press F5 on your chart, do you see the correct entries now?
        Attached Files

        Comment


          #5
          Thank you Patrick. No wonder it didn't work.

          It's strange. Now it's getting some right ones, but not all of them. And a lot of wrong ones as well (screen attached). In this screen, there are 9 longs and only 2 went above both thresholds as can be seen from the chart. And no shorts from condition 2 and no exits from conditions 3 and 4.
          Attached Files
          Last edited by protrader77; 11-20-2013, 04:41 PM.

          Comment


            #6
            Hello Pedro,

            Thank you for your response.

            I do apologize but I do not see the same thing in your screenshot, could you perhaps highlight the trades with a drawing object in the chart?

            I look forward to your response.

            Comment


              #7
              Sorry, that was a very crowded chart. Both MaSlopeLine histograms must be above their upper green lines for a long and both below the lower green line for a short. There are 2 buys were both conditions for a long were true (highlighted in green). In the other 6 (highlighted in red), at least one of the conditions was not true (also highlighted in red the false conditions).

              Also, many times the condition for a short was true, and no short was taken.

              Hope this explains it better. Thank you for your help.
              Attached Files
              Last edited by protrader77; 11-20-2013, 06:22 PM.

              Comment


                #8
                Hello protrader77,

                Thank you for your response.

                Can you save your chart as a template and then attach the template to your response so I may test this item on my end with the same settings?

                To save your chart as a template please right click in your chart > select Templates > Save As > save as 'Support' > then go to the following directory on your PC: (My) Documents\NinjaTrader 7\templates\Chart > then attach the Support.XML file to your response.

                I look forward to your response.

                Comment


                  #9
                  Ok, here it is. I had to rename it because .xml is not supported. If that causes a problem, please let me know.

                  Thank you.
                  Attached Files

                  Comment


                    #10
                    Hello Protrader77,

                    Thank you for your response.

                    This is due to no value being set for the PlotDn when deg[0] is greater than zero or to PlotUp when deg[0] is no greater than zero. This results in the last price being used and this value is always going to be higher than the parameters for the strategy.

                    To correct this please change the MASlopeLine to reflect the following under the OnBarUpdate() method and the switch for MySlopeType:
                    Code:
                    			switch (MySlopeType)
                    				{
                    					case SlopeTypeMultil.WDS:
                    						 if (deg[0]>0)
                    						{
                    			                PlotUp.Set(deg[0]);
                    							PlotDn.Set(0);
                    						}
                    			             else
                    						{
                    				            PlotDn.Set(deg[0]);
                    							PlotUp.Set(0);
                    						}
                    						break;
                    Please let me know if I may be of further assistance.

                    Comment


                      #11
                      It works perfect. Thank you very much.

                      Comment


                        #12
                        Seems like something is not right. I noticed the plots were different when I added a new MASlopeLine, so I tried creating a new chart from scratch and now the strategy doesn't work. It only takes longs. It appears PlotUp is now Plot0 in the Indicator box and PlotUp is actually PlotDn (see image), so I had to format Plot0 as blue and PlotUp as red for the indicator to look right. That worked for the indicator. But the strategy doesn't let me select Plot0, only PlotUp or PlotDn.

                        Strange that initially it worked.
                        Attached Files
                        Last edited by protrader77; 11-21-2013, 06:18 PM.

                        Comment


                          #13
                          Hello protrader77,

                          Thank you for your response.

                          Your template did result in the same display on my end as well. The template may be corrupted, please shut down NinjaTrader > then go to (My) Documents\NinjaTrader 7\template\Chart > then cut and paste the Support template onto your desktop and then restart NinjaTrader.

                          Please let me know if this corrects the plots.

                          Comment


                            #14
                            I followed your instructions and also removed the indicator template, but it's still the same.
                            Attached Files
                            Last edited by protrader77; 11-21-2013, 07:26 PM.

                            Comment


                              #15
                              Protrader77,

                              Thank you for your reply.

                              I reviewed the code and found that you will need to replace the properties values accordingly.

                              On line 234 you will want to give the PlotUp a Values[1] instead of 0 and for line 240 give the PlotDn a Values[2] instead of 1.

                              Let me know if this helps
                              Cal H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by TheTradingMantis, 01-19-2023, 02:05 AM
                              42 responses
                              909 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by _Zero_, 04-10-2020, 03:21 PM
                              144 responses
                              7,891 views
                              6 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Richozzy38, Yesterday, 01:06 PM
                              7 responses
                              28 views
                              0 likes
                              Last Post Richozzy38  
                              Started by swjake, Today, 12:04 PM
                              5 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by forrestang, Today, 01:41 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X