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

Profit Target Closed After Certain Amount

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

    Profit Target Closed After Certain Amount

    Please, is it sufficient to apply this trade for Ninjatrader to work (codewise).Example Trades are placed to execute immediately. The EA closes all trades for a certain level of Profit Target for the day. No indicator concluded in the trade.Thank you..
    Last edited by Emma1; 03-28-2018, 07:01 PM. Reason: modify

    #2
    Hello.

    Thanks for the post.

    Your question sounds like you would like to stop trading after a certain total profit has been reached.

    The reference sample given below demonstrates that will stop itself if there are three consecutive losing trades. You can use the same concept to check for your profit and then stop trading for the rest of the day.



    Ex:

    Code:
    if(SystemPerformance.AllTrades.TradesPerformance.GrossProfit > X)
    {
        //Do something
    }
    You may also use the Account class in your strategy to get information on the account the strategy is running on:


    Please let us know if you have any questions.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hello.

      Thanks for the post.

      Your question sounds like you would like to stop trading after a certain total profit has been reached.

      The reference sample given below demonstrates that will stop itself if there are three consecutive losing trades. You can use the same concept to check for your profit and then stop trading for the rest of the day.



      Ex:

      Code:
      if(SystemPerformance.AllTrades.TradesPerformance.GrossProfit > X)
      {
          //Do something
      }
      You may also use the Account class in your strategy to get information on the account the strategy is running on:


      Please let us know if you have any questions.
      In the attached example above (SampleTradeObjects.cs) you suggested,Uses Adx , My Question is , can similar code work and achieve the result with out Indicators. Thank you

      Comment


        #4
        In the attached example above (SampleTradeObjects.cs) you suggested,Uses Adx , My Question is , can similar code result in profit and achieve the result without Indicators. Thank you.

        Comment


          #5
          Hello Emma1,

          thanks for the reply.

          The indicators used in strategies are just a way to assist with calculations. If you were to use no indicators, you could write the code for whatever calculations the indicator is doing within the script. You can use indicators in a script so you do not have to keep writing the same code and everything can be modularized.

          Please let me know if I may be of any further assistance.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by Emma1 View Post
            In the attached example above (SampleTradeObjects.cs) you suggested,Uses Adx , My Question is , can similar code work and achieve the result with out Indicators. Thank you
            I am currently coding in NT7. Not sure if the same Account class is in NT7.

            Comment


              #7
              Hello Emma1,

              thanks for the reply.

              The Account class is not documented in NinjaTrader 7. You may use the Performance class in NinjaTrader 7 as demonstrated by the NinjaTrader 7 version of the reference sample.



              Please let us know if you have any questions.
              Chris L.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,265 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              12 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X