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

arrow issues

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

    #16
    Hello simpletrades,

    Thanks for your reply.

    In the case of Type1Long.cs you have the following code:
    Code:
    		if (
    			Close[1] > Open[1]//green
    		 && Close[0]>Open[1] // closed higher than prior open
    		&& Close[1]<Open[1]//red
    		//&& Close[1]< Open[1]//red	
    		  )
    		{
               DrawDiamond(" up" + CurrentBar, false, 0,Low[0]- (TickSize*dist), Color.Aqua); 
        	}
    Please observe that there is a logic conflict that results in the entire statement not being true, thus no diamonds would be drawn. The conflict is the first statement Close[1] > Open[1] and the third statement: Close[1]<Open[1], these would not be true at the same time thus the diamond would not be drawn.
    Paul H.NinjaTrader Customer Service

    Comment


      #17
      Hello,

      Thanks for your reply:

      Originally posted by simpletrades View Post
      Forget the dots. I had it coded without the first bar being[0] but please try to figure out why the arrows aren't printing on all symbols all the time.
      Based on the code you have sent, please see my response in post #2, you will need to check for bars to be loaded before accessing them.
      Paul H.NinjaTrader Customer Service

      Comment


        #18
        I know
        I caught it finally after uploading the files and wrote you back.
        Also I forgot I had switched the updots to diamonds so if they were there I'd definitely see them.
        It works fine now but the arrows don't seem to show on all symbols. And the code is OK I think because otherwise ES and CL now would not show both up and down arrows.
        Also, I'd like to be able to set the dot and arrow colors on each chart the same as I do for distance rather than have the color hard coded in the file.
        Can you show me how.

        Comment


          #19
          Hello simpletrades,

          Thanks for your reply.

          Regarding the arrows, you will need to implement what I have advised in post #2. The reason you see it working some times and not other has to do with the fact that your logic has multiple conditions and if the first condition is not true it will not check the 1st or 2nd condition (which are looking at bars 1 & 2 ago) when processing the first bar, 2nd bar, 3rd bar, once you get through those the indicator would perform. When you do not see the arrows as expected, check the "log" tab of the control center for any error messages related to the indicator.

          Regarding the color inputs, please see example and information here: http://ninjatrader.com/support/forum...ead.php?t=4977
          Paul H.NinjaTrader Customer Service

          Comment


            #20
            I'll look over it again tonite as to logic like your post 2, but if the code and logic on arrows works on ES and cL today why not on FDAX which isn't giving uparrows or the 6E which today is not giving down arrows.If the logic confuses one symbol why not all?
            I just looked at the log and there were errors at 933 which I think is when I was looking at other symbols. Is there away for the log to tell me which symbols generated the error
            Last edited by simpletrades; 11-07-2016, 08:40 AM.

            Comment


              #21
              Hello simpletrades,

              Thanks for your reply.

              Previously answered: The reason you see it working some times and not other has to do with the fact that your logic has multiple conditions and if the first condition is not true it will not check the 1st or 2nd condition (which are looking at bars 1 & 2 ago) when processing the first bar, 2nd bar, 3rd bar, once you get through those the indicator would perform. When you do not see the arrows as expected, check the "log" tab of the control center for any error messages related to the indicator.
              Paul H.NinjaTrader Customer Service

              Comment


                #22
                Thanks I'll play with that tonite but I still think the FDAX isn't responding because I didn't write the code in German in spite of what you think.

                How do I tell It not to plot an arrow if the previous bar had one?

                Comment


                  #23
                  Hello simpletrades,

                  Thanks for your reply.

                  If the arrows are not showing check the "log" tab of the control center for any error messages related to the indicator.

                  If you want to prevent plotting arrows on two bars in a row you would need to modify your conditions to include a check to see if the previous bar was one that an arrow was placed. You could do this by recording the bar number of the last time the code drew an arrow. for example:

                  In #region Variables, add:

                  private int saveBar = 0; // saveBar will hold the bar number of the latest arrow drawn

                  In the OnBarUpdate() method:

                  if ( Close[0]> Open[0] && Close[0]>High[1] && Close[2]< Open[2] && CurrentBar- saveBar > 1)
                  {
                  DrawArrowUp(" up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Yellow);
                  saveBar = CurrentBar; // save the current bar number
                  }


                  The code: CurrentBar - saveBar > 1 will check that more than 1 bar has passed since the last arrow placed, use whatever number of bars in place of the 1 you wish
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #24
                    Thanks I'll try that tonite too, but didn't it used be coded if something happened on bar[1] do not plot?--

                    Comment


                      #25
                      hello simpletrades,

                      Thanks for your reply.

                      Those are your existing code conditions that I added to for the example.
                      Paul H.NinjaTrader Customer Service

                      Comment


                        #26
                        No I meant 4 or 5 years ago wasn't saying' do no plot' the way you would say not to draw something again if it already plotted

                        Comment


                          #27
                          I'm using >3 for the repeat arrows and it looks fine. The big runs today now mostly show the first arrow only.
                          Thanks again.

                          Comment


                            #28
                            alert on arrow

                            Now I want to add sound-- even just Alert1 in Program Files(x86) Ninja7 Sounds.
                            After... if (AlertBool == true) I don't know what to say.
                            Will you help please.
                            Attached Files

                            Comment


                              #29
                              Hello simpletrades,

                              Thanks for your reply.

                              To play sounds you would use PlaySound(): http://ninjatrader.com/support/helpG...?playsound.htm

                              So where you draw the arrow you would add if(AlertBool) PlaySound(filename and file path string here);
                              Paul H.NinjaTrader Customer Service

                              Comment


                                #30
                                I did it I think--it compiles. I wont know until I get an opportunity.
                                Thanks.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by algospoke, Yesterday, 06:40 PM
                                2 responses
                                19 views
                                0 likes
                                Last Post algospoke  
                                Started by ghoul, Today, 06:02 PM
                                3 responses
                                14 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by jeronymite, 04-12-2024, 04:26 PM
                                3 responses
                                45 views
                                0 likes
                                Last Post jeronymite  
                                Started by Barry Milan, Yesterday, 10:35 PM
                                7 responses
                                20 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by AttiM, 02-14-2024, 05:20 PM
                                10 responses
                                181 views
                                0 likes
                                Last Post jeronymite  
                                Working...
                                X