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 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
          44 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
          180 views
          0 likes
          Last Post jeronymite  
          Working...
          X