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

Looking for a tutorial on how to manipulate indicators to create a new indicator

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

    #31
    Ok, if your exit is then the logical reverse of conditions you would need to code those out as well and provide different arrow placement and tags to signify them.
    BertrandNinjaTrader Customer Service

    Comment


      #32
      Originally posted by NinjaTrader_Bertrand View Post
      Ok, if your exit is then the logical reverse of conditions you would need to code those out as well and provide different arrow placement and tags to signify them.
      Well, my entries each have a lot of criteria to be set before a trade is triggered.

      ALL my exits for a BUY signal are just going to be plotted by:
      Code:
      if(ERG_Trade().HISTSlope[1] == -1 )
      				{	
      					Then plot exit		
      				}
      For an exit of a SELL signal, that value above would be +1. But this condition is EVERYWHERE as that value is switching from -1 to 1 all the time. How do I make this signal occur for each entry signal that occurs, and NOT every time that value changes.

      In other words, I only want to plot the exit signal if a trade entry was plotted.

      Comment


        #33
        You would need to 'log' in your code that the system is currently so an entry was plotted, so you could only plot the exits then, this could be done via user variables / a bool flag.

        BertrandNinjaTrader Customer Service

        Comment


          #34
          I created the condition and it worked. Problem is that I have to do this for every individual trade scenario I have, and there are over 200 of them.

          Here is the code snippet. I added that flag I spoke of above, so that it only triggers AFTER the entry condition is satisfied.

          Code:
          if(ERG_Trade().Ltsx[0] == 1 && ERG_Str1().HISTSlope[0] == 1 && ERG_Trade().HIST[0] >= 10 )
          			{
          				if(ERG_Trade().HISTSlope[1] == 1 && ERG_Trade().HISTSlope[2] == 1 && ERG_Trade().HISTSlope[3] == -1)
          				{	
          				DrawArrowUp("arrow"+CurrentBar, true, 0, Low[0]-12*TickSize, Color.Green);
          				DrawText("text0"+CurrentBar, ""+Open.ToString(), 0, Low[0]-30*TickSize, Color.Black);
          				DrawText("text1"+CurrentBar ,"1a_A", 0, Low[0]-38*TickSize, Color.Black);
          				[COLOR="blue"]inTrade_1a_A = 1;[/COLOR]			
          				}
          				
          				[COLOR="Blue"]if(inTrade_1a_A == 1 && ERG_Trade().HISTSlope[1] == -1)
          				{	
          				DrawArrowDown("arrow"+CurrentBar, true, 0, High[0]+12*TickSize, Color.Black);
          				DrawText("text2"+CurrentBar, ""+Open.ToString(), 0, High[0]+30*TickSize, Color.Black);
          				inTrade_1a_A = 0;			
          				}[/COLOR]
          			}

          Comment


            #35
            Great - it will depend on your trade management logic how your further structure it and if you would like to keep track individually of which entries triggered or if all entries should be treated equally so that they all set / reset the same flag. In a strategy this would be determined by the Entry signal names applied, so the managed order submission approach would act as a filter (EntryHandling / EntriesPerDirection).
            BertrandNinjaTrader Customer Service

            Comment


              #36
              Originally posted by NinjaTrader_Bertrand View Post
              Great - it will depend on your trade management logic how your further structure it and if you would like to keep track individually of which entries triggered or if all entries should be treated equally so that they all set / reset the same flag. In a strategy this would be determined by the Entry signal names applied, so the managed order submission approach would act as a filter (EntryHandling / EntriesPerDirection).
              Right now I'll define individual flags for everything, as I want to be sure all the positions can be entered and exited properly.

              Heres a strategy question, I want to eventually create a strategy with this indicator, and as you see on the pictures, I have a bunch of individual setups. Actually, similiar setups, but I labeled them differently based on where the oscilator was at the time of entry. That's why I have so many trade definitions. I kept them so segmented as I wanted to be able to test them all INDIVIDUALLY.

              Is there a way I can test all of these simultaneously, and have the report give me statistics on each setup I have defined individually? So that I don't have to go into my script, and individually toggle which ones I want to test?

              Comment


                #37
                Originally posted by forrestang View Post

                Is there a way I can test all of these simultaneously, and have the report give me statistics on each setup I have defined individually? So that I don't have to go into my script, and individually toggle which ones I want to test?
                I see when you use the EnterLong() command in a strategy, there is a "signalName" parameter there. Does this accomplish what I want, or is this just a label just for visual reference on the chart?

                Comment


                  #38
                  You could assign different signal names for each entry and then choose to set the EntryHandling to use unique entry names, but the reported statistics for the symbol would be involved all setups that triggered.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #39
                    Originally posted by NinjaTrader_Bertrand View Post
                    You could assign different signal names for each entry and then choose to set the EntryHandling to use unique entry names, but the reported statistics for the symbol would be involved all setups that triggered.
                    All the trades will have their individual unique signal names.

                    So what EntryHandling will do for me is just allow me to individually toggle which trades are taken?

                    Is this what you were referring to:

                    Comment


                      #40
                      There is no toggling inbuild, it would take positions in one direction then up to the set entryhandling. You could add user inputs that lets you set which set of entries to use at runtime in the UI.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #41
                        Originally posted by NinjaTrader_Bertrand View Post
                        There is no toggling inbuild, it would take positions in one direction then up to the set entryhandling. You could add user inputs that lets you set which set of entries to use at runtime in the UI.
                        Do you mean how one can toggle which trades in the option menu when you add an indicator to a chart?

                        Do you have the reference link for that?

                        Comment


                          #42
                          Yes, you could toggle with set of conditions to use in your indicator / strategy via user defined inputs :

                          BertrandNinjaTrader Customer Service

                          Comment


                            #43
                            forrestang, send me a PM if you still have questions about the indicator you are calling. I believe I wrote it...

                            Just a suggestions, when checking direction (Slope) use >0 or <0 comparisons rather than ==1 or == -1 ... the logic was designed with that mindset.

                            I am also working on a calling indicator and writing up the Prof's Office strategy.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by The_Sec, Yesterday, 03:37 PM
                            1 response
                            11 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Started by vecnopus, Today, 06:15 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post vecnopus  
                            Started by Aviram Y, Today, 05:29 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post Aviram Y  
                            Started by quantismo, 04-17-2024, 05:13 PM
                            3 responses
                            27 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Started by ScottWalsh, 04-16-2024, 04:29 PM
                            7 responses
                            36 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Working...
                            X