Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetProfitTarget() not working properly

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

    SetProfitTarget() not working properly

    Hello,

    for the last day Iam desperately stuck at SetProfitTarget not working correctly in script.

    Simplified example:
    Code:
    SetProfitTarget("LongContract1", CalculationMode.Ticks, 8);
    EnterLongLimit(1, 10998, "LongContract1");
    Trace Order info in Output:
    13.2.2015 15:00:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='LongContract1' Mode=Ticks Value=8 Currency=0 Simulated=False
    13.2.2015 15:00:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='LongContract1' Mode=Ticks Value=2 Currency=0 Simulated=False
    13.2.2015 15:00:00 Entered internal PlaceOrder() method at 13.2.2015 15:00:00: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=10998,0 StopPrice=0 SignalName='LongContract1' FromEntrySignal=''
    13.2.2015 15:00:00 Cancelled pending exit order, since associated position is closed: Order='NT-00262/Sim101' Name='Stop loss' State=Working Instrument='FDAX 03-15' Action=Sell Limit price=0 Stop price=10997 Quantity=1 Strategy='AvisFiboRobot' Type=Stop Tif=Gtc Oco='NT-00096-302' Filled=0 Fill price=0 Token='d5fa5a3138a242d18fd2d20317f28b3d' Gtd='1.12.2099 0:00:00'
    13.2.2015 15:00:00 Cancelled OCO paired order: BarsInProgress=0: Order='NT-00262/Sim101' Name='Stop loss' State=Cancelled Instrument='FDAX 03-15' Action=Sell Limit price=0 Stop price=10997 Quantity=1 Strategy='AvisFiboRobot' Type=Stop Tif=Gtc Oco='NT-00096-302' Filled=0 Fill price=0 Token='d5fa5a3138a242d18fd2d20317f28b3d' Gtd='1.12.2099 0:00:00'

    13.2.2015 15:05:00 Cancelled expired order: BarsInProgress=0: Order='NT-00262/Sim101' Name='Stop loss' State=Cancelled Instrument='FDAX 03-15' Action=Sell Limit price=0 Stop price=10997 Quantity=1 Strategy='AvisFiboRobot' Type=Stop Tif=Gtc Oco='NT-00096-302' Filled=0 Fill price=0 Token='d5fa5a3138a242d18fd2d20317f28b3d' Gtd='1.12.2099 0:00:00'
    The Long order gets closed before reaching Target profit, as you can see on the picture. It gets closed at 11002 instead of intended close at 11006. (In this case, it should exit at StopLoss, never reaching ProfitTarget at 11006)

    Can someone help/explain/point me to the right solution? Thank you very much in advance.

    Attached Files

    #2
    Hello Avisak,

    Thank you for your note.

    I am having a really hard time reading this picture as there seems to be a mixture of missing bars or not painted and making it difficult to follow.

    However, based on what I can see , it appears that the price did go above the Profit Target's value and the price never dipped down below the Stop price and thus the profit was filled.

    Additionally, FDAX is a .5 ticksize instrument and 8 ticks would be 4 points as indicated by the price placement of the order.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      That seems to be it! When I double the ticks in SetProfitTarget(), (16 instead of 8 in this case) the strategy is now working in all cases as intended. Thank you very much

      Originally posted by NinjaTrader_Cal View Post
      Additionally, FDAX is a .5 ticksize instrument and 8 ticks would be 4 points as indicated by the price placement of the order.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X