Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetProfitTarget in Historical data

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

    SetProfitTarget in Historical data

    Hello,

    In a strategy not in real time data but on historical data I used 2 function:
    1) SetStopLoss,
    2)SetProfitTarget

    They are calculated and update in OnBarUpdate with a strategy.
    SetStopLoss works well, when the data reach the stop loss, a signal stop loss is generated and exit strategy.
    But when SetProfitTarget reach the price target no signal is generated.

    Does SetProfitTarget work using historical data?
    Thanks

    #2
    Hello henry77,

    Thank you for your post.

    The SetProfitTarget will work on Historical Data. Can you provide further details on what is occurring?

    Are you stating that in the Historical Performance or Strategy Analyzer that you can see the Stop Loss is always filled when either the Profit Target or Stop Loss could have filled?

    Comment


      #3
      Hello,

      I have done other debug session but I don't undersand the problem.
      The strategy in two words: if Instrument is > band of bollinger buy long, stop loss = under the band of bollinger or medium band of bollinger.
      setprofittarget = upper band or medium band of bollinger
      If istrument is < band of bollinger exatly the cotrarian,

      I send to you a little example with the indication of the problem.
      I used yahoo connession on Unicredit Bank from 05/12/2016 to 03/12/2016.
      The problem is at 17/09/2016 when the strategy is in short and the profittarget is reached but the system doesn't create the signal Profit target.
      In the "takeprofitexample.jpg" you can see takeprofit is set to 1,98 and the istrument reach 1,97 but no signal is set.
      Thanks for your time.
      Attached Files

      Comment


        #4
        Hello henry77,

        Thank you for your patience.

        Can you enable TraceOrders and add Time[0] to your Print statements. Once complete can you provide the full Output after running the strategy?

        Comment


          #5
          In the attachment you can find the report requested.
          Thanks
          Attached Files

          Comment


            #6
            Hello henry77,

            Thank you for your response.

            The Profit Target was amended on the 17/9/2016 bar, this means the price of 1.97 is now the value for the next bar and not the 17/9/2016 bar.
            17/09/2016 06:00:00 Strategy 'setprofitexmple/84378463': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='EnterShortSMA' Mode=Price Value=1,98013931437749 IsSimulatedStop=False IsMarketIfTouched=True

            17/09/2016 06:00:00 Strategy 'setprofitexmple/84378463': Amended target order orderId='NT-00023-2568' account='Sim101' name='Profit target' orderState=Working instrument='UCG' orderAction=BuyToCover orderType='MIT' limitPrice=1.97 stopPrice=1.9 quantity=1.000 tif=Gtc oco='NT-00014-2568' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2016-09-03 06:00:00' gtd='2099-12-01' statementDate='2016-12-07'

            Time =17/09/2016 06:00:00short: Takeprofit = 1,98013931437749 StopLoss2,21845

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            66 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            141 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            75 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            46 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            51 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X