Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculationMode.Dollar?

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

    CalculationMode.Dollar?

    I would like to suggest that a CalculationMode.Dollar be developed for the SetStopLoss(), SetTrailStop(), and SetProfitTarget() built-in functions for use in the the fully disclosured overide signiture. In my attempt to get CalculationMode.Ticks to work as a substitute by using:

    StopLossTicks = StopLossDollar / (Instrument.MasterInstrument.PointValue * Ticksize);
    SetStopLoss("BuyEntry", CalculationMode.Ticks, StopLossTicks, false);
    I would get an error when I execute this in the Initialize() method but not in the OnBarUpdate() method. I realize other override signitures can accommodate Dollar amounts as a value, but then I loose the ability to address a specific fromEntrySignal reference. Is this currently a limitation or am I overlooking something? Any thoughts on workarounds would be appreciated. Thanks!

    Regards,

    Whitmark
    Last edited by whitmark; 07-07-2007, 01:52 AM.
    whitmark
    NinjaTrader Ecosystem Vendor - Whitmark Development

    #2
    Not sure I follow. Doesn't signature below (and related) do what you are looking for?

    protected void SetStopLoss(double currency)

    Comment


      #3
      True, but let's say I want to use different dollar based stop loss amounts for "BuyEntry" vs "SellEntry" entry signals . . . how would I go about doing that for both the call in the Initialize() method and subsequent dynamic modifications in OnBarUpdate()? Thanks.

      Regards,

      Whitmark
      whitmark
      NinjaTrader Ecosystem Vendor - Whitmark Development

      Comment


        #4
        Call it twice passing in the different entry signal names with the different stop values. Same in OnBarUpdate().
        RayNinjaTrader Customer Service

        Comment


          #5
          Please allow me to clarify. If I use the following signiture, I can do dollar values but I can't reference a specific fromEntrySignal . . .

          SetStopLoss(double currency)
          and if I try to convert it to CalculationMode.Ticks with the following code, it appears that the call to the Instrument object fails in the Initialize() method. Any particular reason for this?

          BuyStopLossTicks = 150 / (Instrument.MasterInstrument.PointValue * Ticksize);
          SetStopLoss("BuyEntry", CalculationMode.Ticks, BuyStopLossTicks, false);

          SellStopLossTicks = 250 / (Instrument.MasterInstrument.PointValue * Ticksize);
          SetStopLoss("SellEntry", CalculationMode.Ticks, SellStopLossTicks, false);
          As you suggest Ray, I could just set a first run switch in OnBarUpdate() and call this code there if there is no need for an initial reference in the Initialize() method.

          Hence my suggestion for a CalculationMode.Dollar and a signiture profile that can be used in the Initialze() method and includes a reference to a specific fromEntrySignal to enable differential long vs short dollar based stops.

          Thanks,

          Whitmark
          whitmark
          NinjaTrader Ecosystem Vendor - Whitmark Development

          Comment


            #6
            Instrument may be null in Initialize() therefore we prevent calling it.
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            581 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            338 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X