Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CustomStrategy

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

    CustomStrategy

    I am wanting to create a Auto Strategy that enters Qty x 2. Then when a set Price is reached it closes half the position then starts Trailing. I can write this code in my own app and use the DLL link but i am trying to rewrite everything inside ninja, so that it runs smoother and faster.
    I'm experiencing 2 issues. firstly it will only execute the first entry see below.

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (EMA(55)[0] < EMA(55)[1]
    && Position.Quantity == 0)
    {
    EnterShort(1, "One");
    EnterShort(1, "Two");
    }

    and i cant seem to work out how to get it to autotrail after it hits a set price.
    SetProfitTarget("One", CalculationMode.Ticks, 150);
    SetStopLoss("One", CalculationMode.Ticks, 150, false);
    SetProfitTarget("Two", CalculationMode.Ticks, 1000);
    SetTrailStop("Two", CalculationMode.Ticks, 150, false);

    Any help will be great. if you have sample code, etc...
    or when entering through a strategy can you apply a saved ATM?
    Last edited by pnewen; 07-11-2012, 07:06 PM. Reason: add more notes.

    #2
    Never mind i found the example code in ninja and it works!
    Thanks anyway.

    Comment


      #3
      Glad to hear and thanks for updating the thread.
      BertrandNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      238 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      4 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Working...
      X