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.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      72 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      39 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X