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

Takeprofit and reverse

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

    Takeprofit and reverse

    Hi,
    sorry for my english,
    I need to revese the position in the same bar and moment of takeprofit.
    How can i do?
    Something like this...

    if(...)
    EnterLong("EnL1");
    SetProfitTargetANDREVERSE("EnL1", CalculationMode.Percent, 0.1);

    #2
    Hi Fabri, welcome to our forums - there would be unfortunately not a Set Target method that would offer the option to reverse as well, but you could custom code to achieve this trait.

    For example you could detect the Execution of the Set Target and then issue your reverse order as needed -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      I tried with this script....
      if (Position.GetProfitLoss(V, PerformanceUnit.Percent)>=0.01)
      EnterShort("EnS1");

      but I failed because beacktest does not gave me the signal profit and reverse at the same bar and moment... can you help me please?
      I need to write this script..
      SetProfitTarget ("EnL1", CalculationMode.Percent, 0.1).... when condition profitTarget=true entershort or shortsell at the same livel of target
      Last edited by fabri; 04-24-2012, 01:56 AM.

      Comment


        #4
        nobody can help me to write it in ninjatrader language?
        thanks

        Comment


          #5
          fabri, we can unfortunately not custom code this for you - but with the sample I provided you could check when the Profit Target order executes and then submit your reverse order in OnExecution() - this would work for a backtest as well.

          If you seek to have the code needed created professionally for you - please check with those certified NinjaScript consultants available - http://www.ninjatrader.com/partners#...pt-Consultants
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by lightsun47, Today, 03:51 PM
          0 responses
          5 views
          0 likes
          Last Post lightsun47  
          Started by 00nevest, Today, 02:27 PM
          1 response
          10 views
          0 likes
          Last Post 00nevest  
          Started by futtrader, 04-21-2024, 01:50 AM
          4 responses
          46 views
          0 likes
          Last Post futtrader  
          Started by Option Whisperer, Today, 09:55 AM
          1 response
          14 views
          0 likes
          Last Post bltdavid  
          Started by port119, Today, 02:43 PM
          0 responses
          10 views
          0 likes
          Last Post port119
          by port119
           
          Working...
          X