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 arvidvanstaey, Today, 02:19 PM
      4 responses
      10 views
      0 likes
      Last Post arvidvanstaey  
      Started by samish18, 04-17-2024, 08:57 AM
      16 responses
      56 views
      0 likes
      Last Post samish18  
      Started by jordanq2, Today, 03:10 PM
      2 responses
      8 views
      0 likes
      Last Post jordanq2  
      Started by traderqz, Today, 12:06 AM
      10 responses
      18 views
      0 likes
      Last Post traderqz  
      Started by algospoke, 04-17-2024, 06:40 PM
      5 responses
      47 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X