Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Differents Intruments - Differents Points!

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

    Differents Intruments - Differents Points!

    Hi all,

    i've a very stupid problem, but i don't find anything to resolve it.

    I want to stop my strategy when i arrive at 20 points target (and not in currency).

    When i'm in position, i have to calculate te cumprofit realized and unrealized:

    realized :
    Performance.RealtimeTrades.TradesPerformance.Point s.CumProfit ;

    unrealized: (when i'm in position)
    Position.GetProfitLoss(Close[0],PerformanceUnit.Points);

    and check total cumprofit in this mode:
    if ((realized+ unrealized) >= maxProfit || (realized+ unrealized) <= maxLoss)
    stopStraetgy();


    maxProfit and maxLoss is points (like 20).

    the issue is:

    on instruments YM or other the code work fine,
    in others instruments (like 6J,6E) this code not work beacuase the return in points of the realized or unrealized isn't an integer value but decimal value! (0,79999 an not 8 points of unrealized/realized !)

    how to resolve it??
    thanks!!

    PS: i get the same problem when i go in the panel "Account performance" -> Gen the statistics and view daily trades...

    #2
    Originally posted by wyatt376 View Post
    Hi all,

    i've a very stupid problem, but i don't find anything to resolve it.

    I want to stop my strategy when i arrive at 20 points target (and not in currency).

    When i'm in position, i have to calculate te cumprofit realized and unrealized:

    realized :
    Performance.RealtimeTrades.TradesPerformance.Point s.CumProfit ;

    unrealized: (when i'm in position)
    Position.GetProfitLoss(Close[0],PerformanceUnit.Points);

    and check total cumprofit in this mode:
    if ((realized+ unrealized) >= maxProfit || (realized+ unrealized) <= maxLoss)
    stopStraetgy();


    maxProfit and maxLoss is points (like 20).

    the issue is:

    on instruments YM or other the code work fine,
    in others instruments (like 6J,6E) this code not work beacuase the return in points of the realized or unrealized isn't an integer value but decimal value! (0,79999 an not 8 points of unrealized/realized !)

    how to resolve it??
    thanks!!

    PS: i get the same problem when i go in the panel "Account performance" -> Gen the statistics and view daily trades...
    Round your calculations off or to ticksize. ref: http://www.ninjatrader.com/support/h...trument_ro.htm

    Comment


      #3
      I solved this manually..

      for calculate number of ticks realized and unrealized i use this code:

      Code:
      double tickValue = TickSize * Instrument.MasterInstrument.PointValue;
      			
      int dailyCumProfit = Math.Round(Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit / tickValue);
      if (position is flat) unrealized = Math.Round(Position.GetProfitLoss(Close[0],PerformanceUnit.Currency) / tickValue);
      else unrealized=0;
      thanks!

      i don't understand the result of Round2TickSize ...
      if i have a number of points getted this method return the number of ticks?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      666 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      377 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      110 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X