Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

On Execution Entry Price

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

    On Execution Entry Price

    Hello,

    I´m experiencing issues with doubles deriving from onExecution. So I try to find out the difference of

    * execution.Order.AvgFillPrice
    * Position.AvgPrice
    * entryOrder.AvgFillPrice

    From the HelpGuide I don´t understand when to use which one exactly. When should be used which of them?

    Thank you
    Tony

    #2
    Hello,

    Thank you for the question.

    execution.Order.AvgFillPrice is the AvgFillPrice of the Executed Order that is calling OnExecution. You will see in the OnExecution override that it provides the execution object, this is the Execution that called the OnExecution overide. The AvgFillPrice would be that of the execution reported in the override.

    Position.AvgPrice would be specific to the Current Strategy Position, for example if you are in a long position, this would be the AvgPrice for that position.

    entryOrder.AvgFillPrice would be specific to a variable named entryOrder, this likely came from a sample you have seen as we often use entryOrder as a variable name. This would be used in the case you had stored a IOrder object, that order had filled and you wanted to check its AvgFillPrice.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      thank you for your reply. Yes, I use this from the samples. But which of them is to use when I want to get the value for the profittarget? now I have
      avgFill = entryOrderkSa.AvgFillPrice;
      profittarget = entryOrderkSa.AvgFillPrice - 8*TickSize;

      It seems to be the same result with execution.order.AvgFillPrice and entryOrder.AvgFillPrice, no?

      And to control I have Drawtextfixed with that value in the chart. But in my short script it doesn´t work and in the chart I have for avgFill and profittarget both "0" instead of the correct values.

      What might be wrong there? I went over 10 times to compare the long and the short script. While the long script plots the values correctly in the chart and also the targets work from script,the short script values are 0. Is this referring to ask or bid somehow?

      Thank you
      Tony
      Last edited by tonynt; 04-26-2016, 01:22 PM. Reason: clearifying

      Comment


        #4
        Hello,

        the syntax provided:

        Code:
        avgFill = entryOrderkSa.AvgFillPrice;
        profittarget = entryOrderkSa.AvgFillPrice - 8*TickSize;
        The names of these variables seem to say that this specifically is dealing with your entry which is not the target, "entryOrderkSa", is this the IOrder for the Entry order? or is this a variable you are setting to the Profit Target in OnExecution?

        Because I currently do not know the context of the file you are creating, it is hard to say when you use variable names instead of the full syntax. I will provide a general statement below that may apply to what you are doing, instead if you can provide the syntax for submitting the Target it would be helpful.

        If you are using SetProfitTarget() or the Set methods in general, these do not produce an IOrder object so you would need to monitor OnExecution for a Profit Target to fill. The syntax you provided assumes you have an IOrder object to access the AverageFillPrice, if that IOrder is the entry it will not contain the targets information.

        If you are using the Unmanaged approach and submitting your own targets with SubmitOrder, this does produce an IOrder and could be referenced. I do not want to over complicate the post so I will end the unmanaged portion with only this comment.

        Can you provide more detail on how you are setting the target? Likely you will need to monitor OnExecution to find when the target Fills, from that event you can get the Average Fill Price.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        1 response
        7 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        385 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X