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 argusthome, 03-08-2026, 10:06 AM
      0 responses
      66 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      41 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      24 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      27 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      53 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X